This needs to be a pseudocode. Employee and ProductionWorker Classes Design an E
ID: 3920201 • Letter: T
Question
This needs to be a pseudocode. Employee and ProductionWorker Classes Design an Employee class that has fields for the following pieces of information: Employee name Employee number Next, design a class named ProductionWorker that extends the Employee class. The ProductionWorker class should have fields to hold the following information: Shift number (an integer, such as 1, 2, or 3) Hourly pay rate The workday is divided into two shifts: day and night. The shift field will hold an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2. Design the appropriate accessor and mutator methods for each class. Once you have designed the classes, design a program that creates an object of the ProductionWorker class and prompts the user to enter data for each of the object’s fields. Store the data in the object and then use the object’s accessor methods to retrieve it and display it on the screen.
Explanation / Answer
SOLUTION:
According to the given data the following code follows:
The below is the pseudo code;
//pseudo code
//Employee class
class Employee
Declarations
string Name
string Number
void setName(string name)
Name=name
return
string getName()
return Name
void setNumber(num number)
Number=number
return
num getName()
return Number
endClass
//ProductionWorker class
class ProductionWorker inheritsFrom Employee
Declarations
num shiftNumber
num hourlyPayrate
void setShiftNumber(num shiftnumber)
do
if shiftnumber>=1 and shiftnumber<=2
shiftNumber=shiftnumber
else
output "Enter shift number 1-2"
while shiftNumber<1 or shiftNumber>2
return
void setPayrate(num payrate)
hourlyPayrate=shiftnumber
return
num getShiftNumber()
return shiftNumber
num getPayRate()
return hourlyPayrate
endClass
//main program
start
Declarations
ProductionWorker pWorker
pWorker.setName("NAME")
pWorker.setNumber(NUMBER)
pWorker.setShiftNumber(NUMBER)
pWorker.setPayrate(NUMBER)
output "EMPLOYEE DETAILS"
output "Employee Name ",pWorker.getName()
output "Employee ID",pWorker.getNumber()
output "Employee shift",pWorker.getShiftNumber()
output "Employee pay Rate",pWorker.getPayRate()
stop
Hence our required data is obtained.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.