Question: Create a class named Worker which contains a name attribute, available to the entire program ( public ) , an ID number, hours worked, and

Create a class named Worker which contains a name attribute, available to the entire program (public), an ID number, hours worked, and an hourly pay rate, available only to the members of the Worker class (private). Also write a constructor (the __init__ method) which accepts the ID number, hours worked, and the hourly pay rate. The method should change the hourly pay rate to 7.75, if the value entered is less than that. Do not write any accessor or mutator methods for the class.
2. Write one statement (only one line of code) that creates an object called hourlyWorker, from the Worker class and passes 12.75 as the hourly pay rate.
3. Write one statement (only one line of code) that assigns "Jane Green" to the name attribute of the object created in part 2.

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 Programming Questions!