Question
Use the following UML diagram to create three class definitions. Recognize the significance of the triangle in the UML and include the appropriate extends clause
Use the following UML diagram to create three class definitions.
Recognize the significance of the triangle in the UML and include the appropriate "extends" clause in the source files.
Use the following table to determine how to code the toString method for each class.
Class | Example output of System.out.print(object.toString() ; |
Employee | Employee: John Doe, 1234567 |
Foreman | Jane Roe is a foreman in the Shipping area. |
LineWorker | Frank Jones is a line worker on Shift 1. |
Create a 4th file, an application class that includes a main function that performs the following operations.
Create 2 Employee objects who are neither Foreman nor LineWorker
1 of the Employee objects must be created using the constructor that contains parameters.
1 of the Employee objects must be created with the constructor that takes no arguments. For this instance, use the mutator methods to set the values.
Create 2 Foreman objects
1 of the Foreman objects must be created using the constructor that contains parameters.
1 of the Foreman objects must be created with the constructor that takes no arguments. For this instance, use the mutator methods to set the values.
Create 2 LineWorker objects
1 of the LineWorker objects must be created using the constructor that contains parameters.
1 of the LineWorker objects must be created with the constructor that takes no arguments. For this instance, use the mutator methods to set the values.
Print all 6 objects by printing calls to toString().
Note, it is not necessary to prompt the user to enter the values for the fields. You can hard code the values.
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