Project5 CECS277 solution

$25.00

Category:

Description

5/5 - (3 votes)

Employee and ProductionWorker Classes
Design a class named Employee. The class should keep the following
information in fields:
▪ Employee name
▪ Employee number in the format XXX–L, where each X is a digit
within the range 0–9, and the L is a letter within the range A–M. It
should be total of 5 characters.
isValidEmpNum:
This private method returns true if the argument e is a
valid Employee ID number. Othewise, it returns false. The
isValidEmpNum should be called from setEmployeeNumber().
As long as the user does not enter a valid Employee number
in the right format, isValidEmpNum will be called again.
Use while loop for this to make it work properly.
▪ Hire date
Follow the Unified Modeling Language diagram below to create Employee
fields, constructors and the appropriate accessor and mutator methods
for the class.Employee Class UML
Next, write a class named ProductionWorker that inherits from
the Employee class. The ProductionWorker class stores data about an
employee that is a production worker. The ProductionWorker class
should have fields to hold the following information:
▪ Shift (an integer) Validate the shift value. Make sure the user to enter
only 1 or 2.
▪ Hourly pay rate (a double) No need for validation for this one.
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 two constructors and the appropriate accessor and mutator
methods for the class. Please follow the UML below for it:

Demonstrate the classes by writing a program that uses
ProductionWorker objects. Here is how you do this: Create a class
named which has the main method in it. We will create
objects of ProductionWorker class. One of these objects is using the
overloaded constructor to set the values of Employee Name, number,
Date of Hire, shift and payRate.
The other object will ask for user inputs to set those values. For more
details, see the sample output.