Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Write an Employee class that keeps data attributes for the following pieces of information:
- Employee name
- Employee number
- Next, write class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should add data attributes for the following information:
- Shift number (an integer, such as 1, or 2)
- Hourly pay rate
- The workday is divided into two shifts: day and night. The shift attribute will hold an integer representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2. Write the appropriate accessor and mutator methods for each class.
- Once you have written the classes, write a program to test the following:
- First, create two objects:
- An Employee object:
- Name is Mary Johnson, ID is 202
- A ProductionWorker object:
- Name is Johnson White, ID is 305, Shift is 2, Pay_rate is 30
- Print out the Mary’s and Jason’s info. Then,
- Mary’s name is changed to Mary Smith
- Jason’s pay_rate is increased to 32
- Print out the updated Mary’s and Jason’s info.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement