Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

SILVERPLATTER VENTURES is asking you to set up their automated payroll system. S

ID: 3635212 • Letter: S

Question

SILVERPLATTER VENTURES is asking you to set up their automated payroll system. Some characteristics are common to all employees (e.g all employees have a first name, a last name, a unique ID number and a base pay). However, there are characteristics that are unique to each class of employee.
Manager like to consider hours spent on the golf course as worked hours, while engineers consider that time spent commuting to work counts as working time.

The population of SILVERPLATTER VENTURES is detailed in the table below.
Type First Name Last Name Hours Worked Hours on golf course Hours in traffic Pay per hour
Manager John McMillan 45 10 120.00
Manager Melissa Montero 55 5 255.50
Engineer Eddy Lehman 70 8 220.00
Engineer Philip Smith 42 12 124.50
Engineer Adam Spencer 38 5 248.00
Engineer Sofia Stevenson 44 7 320.00

Step 1: the superClass Employee
Write an employee class that has the following variables: first name, last name, unique ID(int), salary (float), base pay(float) and number of worked hours(int). Within the class, implement a constructor that takes as input the first name, the last name, and ID, a number of worked hours and a base pay and sets all the variables appropriately. Implement a weeklyPay method that takes no arguments and return the weekly pay

Step 2: the class Manager
Write a class Manager that inherits from the class Employee. The Manager class has the following extra variable: number of hours spent on a golf course. Within the Manager class, write a constructor that calls the parent class constructor and sets the number of golf hours to zero. Write a method addGolfHorus() that takes the number of golf hours in arguments, sets the number of golf hours variable appropriately and updates the number of worked hours.

Step 3: the class Engineer
Write a class Engineer that inherits from the class employee. The class has an extra variable for the number of hours spent in traffic. Write a constructor that calls the parent class constructor and sets the number of traveling hours to zero. Write a method trafficHours() that takes the number of hours spent in traffic in arguments, sets the number of traffic hours variable appropriately and updates the number of worked hours.

Explanation / Answer

//Step 1)Employee.java public class Employee{ private String firstName; private String lastName; private int uniqueID; private float salary; private float basePay; protected int numberOfWorkedHours; public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public float getSalary() { return salary; } public void setSalary(float salary) { this.salary = salary; } public int getUniqueID() { return uniqueID; } public void setUniqueID(int uniqueID) { this.uniqueID = uniqueID; } public float getBasePay() { return basePay; } public void setBasePay(float basePay) { this.basePay = basePay; } public int getNumberOfWorkedHours() { return numberOfWorkedHours; } public void setNumberOfWorkedHours(int numberOfWorkedHours) { this.numberOfWorkedHours = numberOfWorkedHours; } public Employee(int numberOfWorkedHours, float basePay, int uniqueID, String lastName, String firstName) { this.numberOfWorkedHours = numberOfWorkedHours; this.basePay = basePay; this.uniqueID = uniqueID; this.lastName = lastName; this.firstName = firstName; } public Employee() { } public float weeklyPay(){ return (basePay*numberOfWorkedHours); } } //Step 2) Manager.java public class Manager extends Employee{ private int numberOfHoursSpentOnColfcourse; public Manager(int numberOfHoursSpentOnColfcourse) { this.numberOfHoursSpentOnColfcourse = numberOfHoursSpentOnColfcourse; } public Manager(int numberOfWorkedHours, float basePay, int uniqueID, String lastName, String firstName) { super(numberOfWorkedHours, basePay, uniqueID, lastName, firstName); numberOfHoursSpentOnColfcourse=0; } public Manager() { super(); } public void addGolfHorus(int numberOfHoursSpentOnColfcourse){ this.numberOfHoursSpentOnColfcourse=numberOfHoursSpentOnColfcourse; numberOfWorkedHours += numberOfHoursSpentOnColfcourse; } } //Step 3) Engineer.java public class Engineer extends Employee{ private int noofTraficHours; public int getNoofTraficHours() { return noofTraficHours; } public void setNoofTraficHours(int noofTraficHours) { this.noofTraficHours = noofTraficHours; } public void trafficHours(int noofTraficHours){ this.noofTraficHours=noofTraficHours; numberOfWorkedHours = numberOfWorkedHours+noofTraficHours; } public Engineer() { } public Engineer(int numberOfWorkedHours, float basePay, int uniqueID, String lastName, String firstName) { super(numberOfWorkedHours, basePay, uniqueID, lastName, firstName); noofTraficHours=0; } } Above code as you provided information. if you need more code to extend the system please provide more details, that i can give you code.