Question: Problem Description Develop a tool to keep track of a companys Employees. The Employee Management Prototype will be able to add employees, calculate the weekly

Problem Description Develop a tool to keep track of a companys Employees.

The Employee Management Prototype will be able to add employees, calculate the weekly payroll and the associated taxes, view employees and their employment data, and determine which employee has been employed at the Company for the longest period. Each employees data will be stored in an Employee array (set maximum size for now to be 10). Every employee will have a name, a start employment date (day, month, year) a weekly pay amount and a weekly tax amount. All date input entered from the keyboard must be fully edited for valid data you may use your solution for the OurDate class from assignment #1.

Problem Description Develop a tool to keep track of a companys Employees.

Assign2 contains only a main method, which instantiates one Company reference and calls menu()

Company has a private static int constant which is used to represent the maximum amount of employees, a private static int which is used to keep track of the current amount of employees, an array for Employee references (10 references), one constructor and five methods:

menu() - shows the menu, interacts with the user for menu selection, loops till they exit.

addEmployee()

verifies that the maximum number of Employees is not already hired by the company.

Prompts for the employees name.

Prompts for the employee's hiring date.

Presents a second level of choices for the user to choose the type of Employee to add( Executive, Sales Rep or Programmer)

Keeps track of the current total amount of employees

printEmployeeList()- displays information for the current employees

calculatePayroll() invokes the calculatePay() method for each employee and keeps a running total of the total company pay.

findLongestEmployedEmployee() determines who is currently the longest employed employee based on the results returned from the calculateDays() method in the OurDate class.

Employee is an abstract class. It has an OurDate reference to represent the employees hiring date, a String for the employees name, three double fields for the employees taxable income (the gross pay), the tax to be deducted, and the net pay (after tax pay), three constructors, a getter and a setter for each field, and three methods:

calculatePay() an abstract method with concrete implementations in each of the subclasses

calculateTax() - in order to add some authenticity to the tax deductions, refer to a reference document of your choice in order to find the Canadian Federal Tax Rates for 2016. .

Executive extends Employee. It has a salary field and three constructors, a getter and a setter for salary, and overridden methods for both calculatePay() and toString().

SalesRep extends Employee. It has salesAmount and commissionRate fields and three constructors, a getter and a setter for each field, and overridden methods for both calculatePay() and toString().

Programmer extends Employee. It has hoursWorked and rateOfPay fields and three constructors, a getter and a setter for each field, and overridden methods for both calculatePay() and toString().

OurDate being reused from previous assignment

NOTE 1: Only Company interacts with the user; no other classes should use Scanner or println (etc.).

NOTE 2: Do not use recursion for your method calls instead use a properly coded repetition structure. You will lose marks if recursion is used

NOTE 3: Do not use any kind of go-to statement such as continue, break, System.exit(0), etc in order to implement program logic. Instead, use a properly coded control structure and test for continuity or true/false conditions with a boolean expression. You will lose marks if any go-to statements are used. Appropriate places for break statements include using them in a switch selection structure.

OURDATE.JAVA

public class OurDate { OurDate date; private int day, month, year; //default constructor public OurDate(){ day = 1; month = 1; year = 2000;

} //overloaded constructor public OurDate(int d, int m, int y){ day = d; month = m; year = y; } //second overloaded constructor public OurDate(OurDate date){ date.setYear(year); date.setMonth(month); date.setDay(day); }

public void setMonth(int month){//method to loop your month input if(month > 12 || month

} public void setDay(int day){//loops the user inputted day value

if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12){//loops to check if inputted month is any of these if(day>31){//if user day input is greater than 31, it gets set to 1 setDay(1); } } if (month == 4 || month == 6 || month == 9 || month == 11){//loops to check if inputted month is any of these if(day>30){//if user day input is greater than 30, it gets set to 1 setDay(1); } } if(month==2){//checks it user intput for month is equal to 2 if(isLeapYear(year)){//checks if user inputted year is a leap year if(day>29){//if it is a leap year, and inputted day is greater than 29, it gets set to 1 setDay(1); } } if(day>28){ // if it isnt a leap year, and inputted day is greater than 28, it gets set to 1 setDay(1); } else this.day=day;//else it takes the user input } }

public void setYear(int year){//method to setYear

if ( year

} public void addOne(){//for the displaySevenDays method, adds one to the user inputted date

setDay(this.day + 1);//adds one to this.day and loops it through the setDay method

if (this.day == 1){//after looping if this.day is equal to 1 this.setMonth(this.month + 1);//then this.month gets one added to it and then it gets run through the setMonth method

if (this.month == 1){//if running through the setMonth method sets month to 1 this.setYear(this.year + 1);//this.year gets one added to it and is also run through the setYear method } } } public boolean isLeapYear(int year){//boolean to check if year is a leapyear if((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0)){//takes the user inputted year and checks if it fulfills requirements for a leap year return true;//if yes return true } else return false;//else return false

//Source: http://stackoverflow.com/questions/1021324/java-code-for-calculating-leap-year }

public String toString(){//Returns a string of Year/Month/Day that can be called upon in other classes

return this.getYear() + "/" + this.getMonth() + "/" + this.getDay(); } }

EXAMPLE OUTPUTS

The Employee Management Prototype will be able to add employees, calculate the

weekly payroll and the associated taxes, view employees and their employment data,

and determine which employee has been employed at the Company for the

longest period. Each employees data will be stored in an Employee array

(set maximum size for now to be 10). Every employee will have

a name, a start employment date (day, month, year) a weekly pay

Assign2 +main(args: String ) void Company employees: Employee D MAXNUMEMPLOYEES: int= 10 totalEmplovees: int +Company() +menu: void printEmployeeList: void -calculatePayroll: void -addEmployee: void findLongestEmployedEmployee: void Employee -name: String -startDate: OurDate taxablelncome: double #netPay: double tax: double OurDate same as Assignment +Employee() +Employee(String name, int day, int month, int year) +toString: String +calculatePay): double +calculateTax(): double +getName: String +getStartDate: OurDate +getTaxablelncome: double +getGrossPay: double +getTax: double +setName(String name): void +setStartDate(OurDate date): void +setTaxablelncome(double taxablelncome): void Executive SalesRep Programmer -salary: double +Executive() +Executive(String name, OurDate startDate) +Executive(String name, OurDate startDate, double salary)+SalesRep(String name, OurDate startDate) +calculatePay): double +toString(): String +getSalary(): double +setSalary(double salary): void -salesAmount: double -commissionRate: double -hoursWorked: double -rateOfPay: double +Programmer) +Programmer(String name, OurDate startDate) +SalesRep) +SalesRep(String name, OurDate startDate, double salesAmount, double commissionRate) +Programmer(String name, OurDate startDate, double hoursWorked, double rateOfPay) +calculatePay): double +toString(): String +getSalesAmount): double +getCommissionRate): double +setSalesAmount(double salesAmount): void +setCommissionRate(double commissionRate): void +calculatePay): double +toString(): String +getHoursWorked(): double +setHoursWorked(double hoursWorked) void +setRateOfPay double rateOfPay): void

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!