Loading
View RSS Feed

Angad Kumar Shukla's blog

TCS ILP Case Study : Employee Management System (EMS)

Rating: 2 votes, 4.50 average.
Create a Employee Management System (EMS) for calculating the project billing rate for an
Organization.
Create a class called Employee with details such as employeeId, employeeName,noOfDaysWorked, employeeType
(contract/ permanent).
Create a class called Project with details such as projectname, billingrate, and ArrayList of Employee.
billingrateCalculationInterface is an interface, classes contract and
permanentEmployee implements this Interface.

contract type=$100 per hour
permanent type=$200 per hour

Create a main class called EmployeeManagement which will take the Employee details and project
details from the console.
Invoke a method generatebillingrate() from billingrate calculationInterface to calculate the toatal billingrate
amount by passing the object from project/employee class.
Make necessary assumptions where ever it is required and implement using the Object Oriented
Concepts. Implement exception handling where ever required.



Click image for larger version. 

Name:	output1.JPG 
Views:	3823 
Size:	42.0 KB 
ID:	1107


Click image for larger version. 

Name:	output2.JPG 
Views:	3438 
Size:	24.7 KB 
ID:	1108


Employee Class
Code:
public class Employee {
    String employeeId;
    String employeeName;
    int noOfDaysWorked;
    String employeeType;
    
    public Employee(String employeeId, String employeeName, int noOfDaysWorked,
            String employeeType) {
        super();
        this.employeeId = employeeId;
        this.employeeName = employeeName;
        this.noOfDaysWorked = noOfDaysWorked;
        this.employeeType = employeeType;
    }
    public String getEmployeeId() {
        return employeeId;
    }
    public void setEmployeeId(String employeeId) {
        this.employeeId = employeeId;
    }
    public String getEmployeeName() {
        return employeeName;
    }
    public void setEmployeeName(String employeeName) {
        this.employeeName = employeeName;
    }
    public int getNoOfDaysWorked() {
        return noOfDaysWorked;
    }
    public void setNoOfDaysWorked(int noOfDaysWorked) {
        this.noOfDaysWorked = noOfDaysWorked;
    }
    public String getEmployeeType() {
        return employeeType;
    }
    public void setEmployeeType(String employeeType) {
        this.employeeType = employeeType;
    }
    
}
Permanent Class :
Code:
import java.util.ArrayList;


public class Permanent implements BillingRateCalculationInterface
{
    public int generatebillingrate(Project p)
    {
        int rate=200;
        int total=0;
        ArrayList<Employee> empList=p.getEmp();
        for(Employee e:empList)
        {
            if(e.getEmployeeType().equals("Permanent"))
                total+=e.getNoOfDaysWorked()*9*rate;
        }
        return total;
    }
}
Project Class :
Code:
import java.util.ArrayList;


public class Project {
    String projectname;
    float billingrate;
    ArrayList<Employee> emp=new ArrayList<Employee>();
    
    public Project(String projectname, float billingrate,
            ArrayList<Employee> emp) {
        super();
        this.projectname = projectname;
        this.billingrate = billingrate;
        this.emp = emp;
    }
    public String getProjectname() {
        return projectname;
    }
    public void setProjectname(String projectname) {
        this.projectname = projectname;
    }
    public float getBillingrate() {
        return billingrate;
    }
    public void setBillingrate(float billingrate) {
        this.billingrate = billingrate;
    }
    public ArrayList<Employee> getEmp() {
        return emp;
    }
    public void setEmp(ArrayList<Employee> emp) {
        this.emp = emp;
    }
    
}
Contract Class :
Code:
import java.util.ArrayList;


public class Contract implements BillingRateCalculationInterface
{
    public int generatebillingrate(Project p)
    {
        int rate=100;
        int total=0;
        ArrayList<Employee> empList=p.getEmp();
        for(Employee e:empList)
        {
            if(e.getEmployeeType().equals("Contract"))
                total+=e.getNoOfDaysWorked()*9*rate;
        }
        return total;
    }
}

Billing Rate Calculation Interface

Code:
public interface BillingRateCalculationInterface {
    public int generatebillingrate(Project p);
}
Employee Management Class
Code:
import java.io.*;
import java.io.IOException;
import java.util.ArrayList;


public class EmployeeManagement {
    public static void main(String args[]) throws NumberFormatException, IOException
    {
        ArrayList<Employee> empList=new ArrayList<Employee>();
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        System.out.println("Enter the number of employee in the project:");
        int n=Integer.parseInt(br.readLine());
        System.out.println("Enter employee information:");
        for(int i=0;i<n;i++)
        {
            System.out.println("Enter employee id:");
            String id=br.readLine();
            System.out.println("Enter employee name:");
            String name=br.readLine();
            System.out.println("Enter the no of days worked:");
            int days=Integer.parseInt(br.readLine());
            System.out.println("Enter type of employee(Permanent/Contract):");
            String type=br.readLine();
            empList.add(new Employee(id,name,days,type));
        }
        Project p=new Project("KCIM", 0, empList);
        
        BillingRateCalculationInterface impl=new Contract();
        int totalRateContract=impl.generatebillingrate(p);
        impl=new Permanent();
        int totalRatePermanent=impl.generatebillingrate(p);
        
        int total=totalRateContract+totalRatePermanent;
        p.setBillingrate(total);
        
        System.out.println("The total billing rate of the project "+p.getProjectname()+" is "+p.getBillingrate());
    }
}

Submit "TCS ILP Case Study : Employee Management System (EMS)" to Digg Submit "TCS ILP Case Study : Employee Management System (EMS)" to del.icio.us Submit "TCS ILP Case Study : Employee Management System (EMS)" to StumbleUpon Submit "TCS ILP Case Study : Employee Management System (EMS)" to Google

Categories
Java

Comments




Disclaimer: Users of techforum4u.com are responsible for ensuring that any material they post (article, blog posts, images or other mulitimedia content) does not violate or infringe upon the copyright, patent, trademark, or any personal or proprietary rights of any third party, and is posted with the permission of the owner of such rights.Anyone who violates these rules may have their access privileges removed without warning.