Question
1 Create two files to submit: Payroll.java - Class definition PayrollClient.java - Contains main() method Build the Payroll class with the following specifications: 4 private
1 Create two files to submit:
Payroll.java - Class definition
PayrollClient.java - Contains main() method
Build the Payroll class with the following specifications:
4 private fields
String name - Initialized in default constructor to "John Doe"
int ID - Initialized in default constructor to 9999
doulbe payRate - Initialized in default constructor to 15.0
doulbe hrWorked - Initialized in default constructor to 40
2 constructors (public)
Default constructor
A constructor that accepts the employees name, ID, and pay rate as arguments. These values should be assigned to the objects name, ID, and payRate fields.
7 public member methods (mutators, accessors, and other)
getName()
getID()
setPayRate() & getPayRate()
setHrWorked() & getHrWorked()
A method named grossPay that returns employees gross pay (=hrWorked * payRate)
(2) In main(), create two Payroll objects: one use the info inputted by the user, and the other use the default constructor, and print the info for each employee Ex:
Enter the name, ID, pay rate, and hours worked of an employee: Linda Smith 1234 20.5 35 Employee Records: Name ID Pay Rate Hrs Worked Gross Pay Linda Smith 1234 $20.50/hr 35.0 $717.50 John Doe 9999 $15.00/hr 40.0 $600.00
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started