Question: language(java) Objective In this assignment you will practice creating a user defined data type including all the needed methods such as the constructor, getter, setter,

language(java)  language(java) Objective In this assignment you will practice creating a user
defined data type including all the needed methods such as the constructor,
getter, setter, and toString methods. problem Design a class called Payroll with
the following UML diagram Payroll Class I list of the instance variables

Objective In this assignment you will practice creating a user defined data type including all the needed methods such as the constructor, getter, setter, and toString methods. problem Design a class called Payroll with the following UML diagram Payroll Class I list of the instance variables -name: String -Id: String -hourlyRate : double -Hours Worked: double //list of the methods *Payroll(String name, String id, double hours Worked, double hourly Rate) //constructor +getName(): String +getid: String *get HourlyRate(): double +getHoursWorked(): double +setName(String name): vold *setHourlyRate(double rate): void +setHours Worked(double hours): vold getPayl): double toString(): String PayrollDriver class I have implemented this class and is available to you. Once you implement the Payroll class, you should be able to run the PayrollDriver class. Once the program is running add the following to the driver class 1. create two objects of the payroll class (your choice of the attributes) 2. display the objects on the screen by calling the toString method 3. display the salary of each person by calling the get Pay method 4. change the hourlyRate of the objects you created 5. display the objects again to see the changes you made by calling the toString method 6. change the hoursworked for the objects you created by calling the setter methods 7. display your objects again to see the changes you made Requirements implement all the methods based on the given description No extra attributes/instance variables can be added follow the UML and implement all the methods Follow the rubric to get full credit What to turn in You are going to turn in only one java file that contains two classes Payroll and PayrollOrlver). Turning in more than one file will not get you the full credit. . . Methods description Constructor public Payroll (String name, String id, double hoursWorked, double hourlyRate): accepts the parameters and initializes the Instance variables of the object Getter methods public String getName(): returns the name of the person public String getid); returns the id of the person public double getHourlyRate(): returns the hourly rate public double getHoursWorked(): returns the number of the hours worked Setter/mutator methods public void setName(String name): changes the name of the person to the given parameter public void setHourlyRate(double rate): changes the hourly rate to the given parameter public void setHours Worked(double hours): changes the hours worked to the given parameter public double getPay(): calculates the amount that the person is getting paid, pay = hourly Rate hours Worked toString method public string toString(): returns a String representing the attributes for the given person. This method should create the string in the given format Name: Alex Martinez ID: 123456 Hours worked: 80.0 Hourly Rate: 25.0 . . Sample output Creating payroll objects testing the toString method List of the employees Name: Alex Martinez ID: 123456 Hours worked: 20.0 Hourly rate: 25.0 Salary is: 500.0 Name: Ali Santos ID: 986747 Hours worked: 45.0 Hourly Rate: 125.0 Salary is: 5625.0 Name: Jose Busta ID: 45678 Hours worked: 30.0 Hourly Rate: 55.0 Salary is: 1650.0 Testing the setter methods The hourly pay of Alex Martinez is being changed Name: Alex Martinet ID: 123456 Hours workedt 80.0 Hourly Rate: 25.0

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!