Question: Help with this Java Assignment. Please Add each class code and assist with comments. In Java, Implement a simple weekly payroll program. The input will
Help with this Java Assignment. Please Add each class code and assist with comments.
In Java, Implement a simple weekly payroll program. The input will consist of
the employees full name, employees ID String the number of hours worked
per week double the hourly rate double the income tax is Your
program should calculate the total gross pay, and the net pay and display a
paycheck similar to:
Employees name: John Smith
Employees number: js
Hourly rate of pay:
Hours worked:
Total Gross Pay: $
Deductions
Tax : $
Net Pay: Dollars
In the rest of this HW Salary means the Gross Pay
hoursWorked times hourlyRate
Your program must include the class Employee whose private fields are:
fullName: String
employeeNumber: String
payRate: double
hoursWorked: double
Dont add any fields to the class Employee
In addition to that, equip the class Employee with these methods:
Employee String fullName, String employeeNumber, double payRate, double
hoursWorked
This constructor assigns the parametres fullName, employeeNumber, payrate,
hoursWorked to the data members.
For each of the private data members above, add a Setter and a Getter
Override the toString method to return the String of the form:
Employee NumberFull Name, x Hours @ y per hour where x is the number
of hours worked and y is the pay rate. As an example,
jsJohn Smith, Hours @ per hour
double netPay the private method that returns the net pay of the
employee. The net pay is calculated by deducting from the gross pay.
See sample check above.
void printCheck the method that prints the paycheck of the employee
as shown above. The printCheck method calls the private netPay method
to get the net pay of the employee. So do not recalculate net pay in
this printCheck method
After completing the code of the class Employee, work on the class Company
whose skeleton is provided below. Have all the three classes in one
java file
DriverClassjava and submit!
What is being asked to code is marked in comments throughout the
DriverClass.java file. See it below.
All students must use DriverClass.java shown below.
Names of Students who worked together
public class DriverClass
public static void mainString args
String fullName "Erika T Jones";
String employeeNumber ej;
double payRate hoursWorked ;
TA will change the payrate and the hours worked to test your code
Employee e;
e new EmployeefullName employeeNumber, payRate, hoursWorked;
System.
out.printlne; To Test your toString method
eprintCheck; This prints the check of Erika T Jones
Company company new Company;
company.hire new Employee Saeed Happy", sh;
company.hire e;
company.
printCompanyInfo;
company.hire new EmployeeEnrico Torres" et;
You may add as many employees to company as you want.
The TAs will add their own employees
Make sure that each employee of company has a unique employeeNumber
company.printCheckab;
company.deleteEmployeesBySalary;
company.reverseEmployees;
System.
out.println company.SearchByNameWaLiD WiLLiAms";
company.printEmployees;
System.
out.printlnBye;
class Employee
Add the private attributes and the methods as mentioned above...
class Company
private ArrayList employeeList;
private String
companyName;
private static String
companyTaxId;
Add static Setters and Getters for companyTaxId. We assume that
all companies share the same companyTaxId and that may change
Add Setter and Getter for the companyName
No need to add a Setter and Getter for employeeList
public Company
employeeList new ArrayList;
companyName "People's Place";
companyTaxId vrtuaCmpan;
public boolean hire Employee employee
Add empoyee to employeeList
Note well that we can't add an employee whose employeeNumber already assigned to
another employee. In that case, this method returns false.
This method returns true otherwise
public void printCompanyInfo
This method prints the compay name, the tax id and the current number of employees
You may choose to print that any way you like!
public void print Employees
This methods prints all employees One employee per line
Note that you already have toString in Employee
public int countEmployees double maxSalary
This method returns the number of employees paid less than maxSalary
public boolean SearchByName String fullName
This method returns true if fullName exists as an employee.
It returns false otherwise
this is a not a case sensitive search.
public void reverseEmployees
This method reverses the order in which the employees were added to the list.
public void deleteEmployeesBySalary double targetSalary
public void printCheck String employeeNumber
end of class Company
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
