STEP 1: Understand the UML Diagram Back to Top Analyze and understand the object UML diagram, which models the structure of the program.
I desperately need help!!! Week 4 needs to be updated to Week 5 instructions below!!! Output image and week 4
files are included in the attachment.
STEP 1: Understand the UML Diagram
Back to Top
Analyze and understand the object UML diagram, which models the structure of the program.
- There are two new Employee derived classes (1) Salaried and (2) Hourly that are derived from the Employee class.
- The Employee class contains a new attribute employeeType and a new constructor that accepts as an argument the assigned employee type.
- Both the Salaried and the Hourly classes override only the CalculateWeeklyPay method of the Employee class (note, this is the method without any parameters.)
- The Salaried class has one attribute “managementLevel” that has possible values from MIN_MANAGEMENT_LEVEL to MAX_MANAGEMENT_LEVEL and a BONUS_PERCENT.
- The Salaried class has a default constructor and parameterized constructor that accepts all the general employee information plus the management level.
- The Hourly has a wage attribute, which respresents the hourly wage that ranges from MIN_WAGE to MAX_WAGE, a hours attributes, which represents the number of hours worked in a week that ranges from MIN_HOURS to MAX_Hours, and a category attributes that accepts string values.
- The Hourly class has a default constructor and parameterized constructor that accepts all the general employee information plus the hours and wage value.
- The Presentation Tier contains two new classes (1) The EmployeeInput class and the EmployeeOutput class
- The EmployeeInput class contains three static methods (1) CollectEmployeeInformation, which accepts any type of Employee object as a argument; (2) CollectHourlyInformation, which accepts only Hourly objects as an argument, and (3) CollectSalariedInformation, which accepts only Salaried objects as an argument.
- The EmployeeOutput class contains two methods (1) DisplayEmployeeInformation, which accepts any Employee type as an argument and (2) DisplayNumberObjects method.
- All the access specifers for the Employee attributes are changed to protected and are depicted with the “#” symbol.
STEP 2: Create the Project Back to Top
You will want to use the Week 4 project as the starting point for the lab. Use the directions from the previous weeks labs to create the project and the folders.
- Create a new project named “CIS247_WK4_Lab_LASTNAME”. An empty project will then be created.
- Delete the default Program.cs file that is created.
- Add the Logic Tier, Presentation Tier, and Utilities folders to your proejct
- Add the Week 4 project files to the appropraties folders.
- Update the program information in the ApplicationUtilities.DisplayApplicationInformation method to reflect your name, current lab, and program description
Note: as an alternative you can open up the Week 4 project and make modifications to the existing project. Remember, there is a copy of your project in the zip file you submitted for grading.
Before attempting this week’s steps ensure that the Week 4 project is error free.
STEP 3: Modify the Employee Class
Back to Top
- Change the access specifier for all the private attributes to protected.
- Add the new attribute employeeType, along with a “read only” property (that is only a “get” method) to access the employee type value.
- Add a new constructor that only accepts the type attribute, which is then used to set the employeeType value. Also, this constructor should initialize all the default values. You can call the default constructor using the syntax: public Employee(string employeeType) : this() { }
- Modify the parameterized constructor that accepts the employee information to accept the employee type, and then set the employeeType with this value.
- Modify the ToString Method to include the employee type.
STEP 4: Create the Salaried Class
Back to Top
- Using the UML Diagrams, create the Salaried class, ensuring to specify that the Salary class inherits from the Employee class.
- For each of the constructors listed in the Salaried class ensure to invoke the appropriate super class constructor and pass the correct arguments to the super class constructor.
- Override the CalculateWeeklyPay method to add a 10 percent bonus to the annualSalary depending on the management level. The bonus percent is a fixed 10 percent, and should be implemented as a constant. However, depending on the management level the actual bonus percentage fluctuates (i.e., actualBonusPercentage = managementLevel * BONUS_PERCENT).
- Override the ToString method to add the management level to the employee information.
STEP 5: Create the Hourly Class
Back to Top
- Using the UML Diagrams, create the Hourly classes, ensuring to specify that the Hourly class inherits from the Employee class.
- For each of the constructors listed in the Hourly class ensure to invoke the appropriate super class constructor and pass the correct arguments to the super class constructor. Notice, that the Hourly employee DOES NOT have an annual salary, which we will then have to calculate (see below).
- Create a Category property (get/set) and the valid category types are “temporary”, “part time”, “full time”.
- Create a Hours property (get/set) for the hours attributes and validate the input using the constants shown in the UML diagram, but since an Hourly employee does not have a formal annual salary we will need to calculate this each time the hour (and wage) properties are set. Add the following code after the validation code in the hours property: base.AnnualSalary = CalculateWeeklyPay() * 48; (assumes working 48 weeks a year).
- Create an Wage property (get/set) for the wage attributes and validate the input using the constants shown in the UML diagram. Add the following code after the validation code in the wage property: base.AnnualSalary = CalculateWeeklyPay() * 48; (assumes working 48 weeks a year)
- Override the CalculateWeeklyPay method by multiplying the wages by the number of hours.
- Update the ToString method to add the category, hours, and wages to the hourly employee information.
STEP 6: Create the EmployeeInput Class
Back to Top
- Create a new class in the Presentation Tier folder called “EmployeeInput”
- Create a static void method called CollectEmployeeInformation that has a single Employee parameter. The declaration should look something like the following:public static void CollectEmployeeInformation(Employee theEmployee)
- Write code statements similiar to what you created in the Week 4 project to collect the generic employee information from the user, except instead of using specific employee objects use the “theEmployee” parameters. For example:In Week 4, you had something like: employee1.FirstName = InputUtilities.GetStringInputValue(“First name”); In the CollectionEmployeeInformation method this can be translated to the following; theEmployee.FirstName = InputUtilities.GetStringInputValue(“First name”);
- Write statements to collect all the generic employee information, including the Benefits information, as you did in the Week 4 project. However, since not all derived types have a AnnualSalary value, DO NOT collect the annual salary data.
- Create a new static void method called CollectEmployeeInformation that accepts an Hourly employee object. Using the InputUtilities methods write statements to collect the wage and hours from the user.
- Create a new static void method called CollectSalariedInformation that accepts a Salaried employee object. Using the InputUtilties methods write statements to collect the management level and the annual salary.
STEP 7: Create the EmployeeOutputClass
Back to Top
- Create a new class in the Presentation Tier folder called “EmployeeOuput”
- Create a static void method called DisplayEmployeeInformation that has a single Employee parameter. The declaration should look something like the following:public static void DisplayEmployeeInformation(Employee theEmployee)
- In the DisplayEmployeeInformation method write an output statement that displays theEmployee object to string method to the console.
- Create static method called DisplayNumberObject that displays the number of employees created.
- Invoke these methods from the main program to display the employee information and number of objects created.
[Hint: move the the statements from the main program into these methods.]
STEP 8: Create the Main Program
Back to Top