Employee Name · Employee Number Next, design a class named ProductionWorker that
ID: 3632083 • Letter: E
Question
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.
You are to submit, as a Microsoft Word Document, the following for this assignment:
1. Pseudocode
2. flowchart
Explanation / Answer
*** employee class *** using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CramsterWork { class Employee { public string EmployeeName; public int EmployeeNumber; public void setEmployeeName(string value) { EmployeeName = value; } public string getEmployeeName() { return EmployeeName; } public void setEmployeeNumber(int value) { EmployeeNumber = value; } public int getEmployeeNumber() { return EmployeeNumber; } /// /// Constructor /// public Employee() { /* default values would go here */ } } } ****** Production Worker class *** using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CramsterWork { class ProductionWorker : Employee { public int ShiftNumber; /* 1,2,3 */ public double hourlyRate; /// /// Constructor /// public ProductionWorker() { } public void setShiftNumber(int value) { ShiftNumber = value; } public int getShiftNumber() { return ShiftNumber; } public void setHourlyRate(double value) { hourlyRate = value; } public double getHourlyRate() { return hourlyRate; } } } **** test program *** using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CramsterWork { class Program { static void Main(string[] args) { ProductionWorker worker = new ProductionWorker(); Console.WriteLine("*** Menu ***"); Console.Write("Enter the Employee's name : "); worker.setEmployeeName(Console.ReadLine()); /* read from the console, set employee name */ Console.Write("Enter the Employee's number : "); worker.setEmployeeNumber(Convert.ToInt32(Console.ReadLine())); /* convert to int value */ Console.Write("Enter {0}'s shift number : ", worker.getEmployeeName()); worker.setShiftNumber(Convert.ToInt32(Console.ReadLine())); Console.Write("Enter {0}'s hourly rate : ", worker.getEmployeeName()); worker.setHourlyRate(Convert.ToDouble(Console.ReadLine())); showEmployeeValues(worker); } public static void showEmployeeValues(ProductionWorker doWork) { Console.WriteLine("Name: {0}", doWork.getEmployeeName()); Console.WriteLine("Number: {0}", doWork.getEmployeeNumber()); Console.WriteLine("Shift Number: {0}", doWork.getShiftNumber()); Console.WriteLine("Hourly Rate: {0}", doWork.getHourlyRate()); } } } a few things you need to observe : Converting values to Int and double. You should incorporate a check for shift numbers : eg. if(shiftNumber < 1 || > 3) also you would want to consider dealing with different Types of workers. you would have to deal with this in the Main method. other then that all the values needed are here in the code. should be easy enough to translat to false code in word Please ask for the flowchart is separate question as it is a lengthy diagram Please rateRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.