In: Computer Science
Q3) Design a class for saving data of employee, the class should have multiple constructors (constructor overloading) for initializing objects with different parameters. The employee class should have different functions for saving and updating bio-data, educational background, and current status like experience, Salary, position & travel history. The employee class should have a function which asks user what do he likes to see about employee (.i.e., Bio-data, current status....) and only show the respective data. Create two objects of interns and shows their educational background, five employees and show their experience to help decide which two should be called for promotions interviews and print data of all employees who left the organization.
This is General Class Design ...... created in Eclipse.
package employeeRecord;
import java.util.ArrayList;
public class Employee {
String EmpName, EmpDept;
int EmpID, EmpSalary;
public Employee(String empName, String empDept, int empID, int empSalary) {
EmpName = empName;
EmpDept = empDept;
EmpID = empID;
EmpSalary = empSalary;
}
// Add details Accordingly --- Employeee Objects
list Can also be created using
// utility Class
Employee Emp1 = new Employee(EmpName, EmpDept,
EmpID, EmpSalary);
Employee Emp2 = new Employee(EmpName, EmpDept, EmpID,
EmpSalary);
Employee Emp3 = new Employee(EmpName, EmpDept, EmpID,
EmpSalary);
Employee Emp4 = new Employee(EmpName, EmpDept, EmpID,
EmpSalary);
Employee Emp5 = new Employee(EmpName, EmpDept, EmpID,
EmpSalary);
// Constructor Overloading
Employee(int empSalary) {
EmpSalary = empSalary;
}
public void AddEmployeeDetails() {
/*
* ......
*
* Code for Adding Details of
employee ---- experience, Salary, position &
* travel history----
*/
};
public void UpdateEmployeeDetails() {
/*
* ......
*
* Code for Adding Details of
employee ---- experience, Salary, position &
* travel history----
*/
};
public void EmployeeStatusReport() {
// Can Add Switch statement to
develop a console asking
// various details mentioned in the
Case Statement.
}
public void OldEmployeeLIst() {
}
public void Promotion() {
// Set Criteria for promotion of the list of Employees
}
}
---------------
package employeeRecord;
public class Intern {
String InternName, InternDept;
int InternID, InternSalary;
public Intern() {
// General Constructor
};
public Intern(String internName, String internDept,
int internID, int internSalary) {
super();
InternName = internName;
InternDept = internDept;
InternID = internID;
InternSalary = internSalary;
}
public void ADDnUpdateInternDetails() {
// TODO Auto-generated method
stub
// Function to Add Educational
Background of the Intern....
}
// Intern Object
Intern Ravi = new Intern();
Intern Sachin = new Intern();
}
If any Doubt do Comment, I will surely reply Do Rate.... :)