Question: Using java help with the TODO public abstract class StaffMember { private String name; private String address; private String phoneNumber; private String ssn; //----------------------------------------------------------------- //
Using java help with the TODO
public abstract class StaffMember { private String name; private String address; private String phoneNumber; private String ssn; //----------------------------------------------------------------- // Constructor: Sets up this staff member using the specified // information. //----------------------------------------------------------------- public StaffMember(String name, String address, String phoneNumber, String ssn) { setName(name); setAddress(address); setPhoneNumber(phoneNumber); setSsn(ssn); } public void setName(String name) throws InvalidParameterException { if (name.length() > 0) this.name = name; else throw new InvalidParameterException("Invalid parameter: \"" + name + "\" - The name must have at least one character"); } public String getName() { // TODO #1 done return this.name; // THIS IS A STUB } public void setAddress(String address) throws InvalidParameterException { // TODO #1 done this.address = address; } public String getAddress() { // TODO #1 done return this.address; // THIS IS A STUB } public void setPhoneNumber(String phoneNumber) throws InvalidParameterException { // TODO #1 done this.phoneNumber = phoneNumber; } public String getPhoneNumber() { return this.phoneNumber; // THIS IS A STUB } public void setSsn(String ssn) throws InvalidParameterException { // TODO #1 done this.ssn = ssn; } public String getSsn() { return this.ssn; // THIS IS A STUB } public boolean equals(Object o) { boolean same = true; if (this != o) { if (o == null || getClass() != o.getClass()) same = false; else { StaffMember other = (StaffMember) o; same = this.name.equals(other.name) && this.address.equals(other.address) && this.phoneNumber.equals(other.phoneNumber) && this.ssn.equals(other.ssn); } } return same; } //----------------------------------------------------------------- // Returns a string including the basic employee information. //----------------------------------------------------------------- public String toString() { return "Name: " + this.name + " " + "Address: " + this.address + " " + "Phone: " + this.phoneNumber + " " + "Social Security Number: " + this.ssn; } //----------------------------------------------------------------- // Derived classes must define the pay method for each type of // employee. //----------------------------------------------------------------- public abstract double calculatePayment(); } public class Payroll { private ArrayList staffList; private final String HOURLY = "Hourly"; private final String EXECUTIVE = "Executive"; private final String VOLUNTEER = "Volunteer"; //----------------------------------------------------------------- // Constructor: Sets up the list of staff members. //----------------------------------------------------------------- public Payroll(Scanner file) { this.staffList = new ArrayList<>(); System.out.println("---> Reading staff data from the file"); // TODO #5 System.out.println("---> Finished reading from the file "); } public void prepareForPayDay() { Random random = new Random(17); // TODO #5 } //----------------------------------------------------------------- // Pays all staff members. //----------------------------------------------------------------- public double[] processPayroll() { double[] pay = new double[this.staffList.size()]; // TODO #5 return pay; } public ArrayList getStaffList() { return new ArrayList<>(this.staffList); } public void displayStaffData() { // TODO #5 } } 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
