To change this template, choose Tools | Templates * and open the

advertisement
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package assignmentkucai;
import java.util.LinkedList;
import java.util.Scanner;
/*
*
* @author asus
*/
public class Employee {
private
private
private
private
private
Scanner
String IdNum;
String TypeTransfer;
double Elaun;
String Status;
String Jawatan;
in = new Scanner(System.in);
public Employee(String x,String y, double z, String w,String v ){
IdNum = x;
TypeTransfer = y;
Elaun = z;
Status = w;
Jawatan =v;
}
String
return
}
String
return
}
double
return
getID(){
IdNum;
getTypeTransfer(){
TypeTransfer;
getElaun (){
Elaun;
}
String getStatus (){
return Status;
}
String getJawatan(){
return Jawatan;
}
void setTypeTransfer(String type ){
TypeTransfer = type;
}
void setStatus(String status){
Status = status;
}
void saveTransferRelate(LinkedList<Employee> db) throws Exception{
java.io.File file = new java.io.File("EMPLOYEE TRANSFER LIST");
java.io.PrintWriter output =new java.io.PrintWriter(file);
for(int i=0;i< db.size();i++){
output.println();
output.print("\nEMPLOYEE NAME = "+db.get(i).getID());
output.print("\nTYPE OF TRANSFER = "+db.get(i).getTypeTransfer());
output.print("\nALLOWANCE = "+db.get(i).getElaun());
output.print("\nSTATUS = "+db.get(i).getStatus());
output.println("\nPOSITION = "+db.get(i).getJawatan());
}
output.close();
}
String searching(LinkedList<Employee> db, String nama){
String output=" ";
for(int i=0;i<db.size(); i++){
if(db.get(i).getID().equals(nama)){
output="EMPLOYEE NAME ="+ db.get(i).getID()+
"\nStatus="+db.get(i).getStatus()+"\nPOSITION="+db.get(i).getJawatan()+"\nALL
OWANCE="+db.get(i).getElaun()+"\nTYPE OF TRANSFER="+
db.get(i).getTypeTransfer();
return output;
}
else if(i== db.size()-1){
output="SORRY,NO RECORD FOUND";
return output;
}
}
return output;
}
String updates(LinkedList<Employee> db,String nama,String stat){
String output="";
for(int i=0;i<db.size(); i++){
if(db.get(i).getID().equals(nama)){
db.get(i).Status=stat;
output="berjaya";
return output;
}
else if(i== db.size()-1){
output="SORRY,NO RECORD FOUND";
return output;
}
}
return output;
}
String baru(LinkedList<Employee> db,String nama,String stat, String tran){
String output="";
for(int i=0;i<db.size(); i++){
if(db.get(i).getID().equals(nama)){
db.get(i).Status=stat;
db.get(i).TypeTransfer=tran;
output=db.get(i).Status+db.get(i).TypeTransfer;
return output;
}
else if(i== db.size()-1){
output="SORRY,NO RECORD FOUND";
return output;
}
}
return output;
}
String display(LinkedList<Employee> db){
String output="";
for(int i=0;i<db.size(); i++){
output+="EMPLOYEE NAME ="+ db.get(i).getID()+
"\nStatus="+db.get(i).getStatus()+
"\nPOSITION="+db.get(i).getJawatan()+
"\nALLOWANCE="+db.get(i).getElaun()+"\nTYPE OF TRANSFER="+
db.get(i).getTypeTransfer();
output+="\n";
}
return output;
}
public void addEmployee(String x,String y, double z, String w,String v ){
IdNum = x;
TypeTransfer = y;
Elaun = z;
Status = w;
Jawatan =v;
}
}
Download