Question
PlEASE PROVIDE CODE IN JAVA Assignment Description: Design a class named Employee. The class should keep the following information in fields: Employee name Employee number
PlEASE PROVIDE CODE IN JAVA
Assignment Description:
Design a class named Employee. The class should keep the following information in fields:
Employee name
Employee number in the format XXXL, where each X is a digit within the range 09 and the L is a letter within the range AO.
Hire date (data type String)
Write one or more constructors and the appropriate accessor and mutator methods for the class.
Next, write a class named ProductionWorker that inherits from the Employee class. The ProductionWorker class should have fields to hold the following information:
Shift
Hourly pay rate
The workday is divided into two shifts: day and night. The shift field will be an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2. Write one or more constructors and the appropriate accessor and mutator methods for the class. Demonstrate the classes by writing a program that uses a ProductionWorker object.
Prompt the user to enter Employee Name, Employee Number, Hire Date, Shift, and Hourly pay rate. Prompt the user only for one employee information.
Note: Do not validate input when entering the data.
If employee number does not meet the format listed above, display the output as listed below:
Employee Number: INVALID EMPLOYEE NUMBER
For Employee number validation, create the validation method in Employee class.
If shift entered is not 1 (DAY) or 2 (NIGHT), display the output as listed below:
Shift: INVALID SHIFT
If the user enters invalid employee number or the shift, do not prompt again. Just display that it is invalid.
Other requirements:
Create a toString method in both Employee and ProductionWorker classes to display the content of the objects.
The output should be similar to the following except the data will depend on user input. As mentioned above, enter data for only one employee.
Here's the first production worker. Name: John Smith Employee Number: 123-A Hire Date: 11-15-2005 Shift: Day Hourly Pay Rate: $16.50 Heres the second production worker. Name: Joan Jones Employee Number: 222-L Hire Date: 12-12-2005 Shift: Night Hourly Pay Rate: $18.50
The Employee Number and Shift entered is invalid:
Here's the first production worker. Name: John Smith Employee Number: INVALID EMPLOYEE NUMBER Hire Date: 11-15-2005 Shift: INVALID SHIFT Hourly Pay Rate: $16.50
Notes:
- Add Comments in your program.
- The program should have proper formatting.
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