The objective of the lab is to take the UML Class diagram and enhance last week's Employee class by making the following changes:
1. Convert the Employee class to an abstract class
2. Add an abstract method called CalculateNetPay to the Employee class
3. In both the Salaried and Hourly classes implement the CalculateNetPay method
Deliverables
Due this week:
· Capture the Console output window and paste into a Word Document.
· Zip the project folder.
· Put the zip file and screenshots (word document) in the drop box.
iLAB STEPS
STEP 1: Understand the UML Diagram
Back to Top
Analyze and understand the object UML diagram, which models the structure of the program.
· The Employee class has been specifed as abstract, which is denoted by the name of the class being italized Employee
· The Employee class as a new method CalculateNetPay which is an abstract method, denoted by the italized name of the method. Since this method is an abstract method the CalculateNetPay method WILL NOT have an implementation in the Employee class.
· The Salaried and Hourly classes both have a new method CalculateNetPay that is inherited from the abstract Employee class and the Salaried and Hourly class both MUST implement the CalculateNetPay method.
STEP 2: Create the Project
Back to Top
You will want to use the Week 5 project as the starting point for the lab. Use the directions from the previous weeks labs to create the project and the folders.
1. Create a new project named "CIS247_WK4_Lab_LASTNAME". An empty project will then be created.
2. Delete the default Program.cs file that is created.
3. Add the Logic Tier, Presentation Tier, and Utilities folders to your proejct
4. Add the Week 5 project files to the appropraties folders.
5. 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 5 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 5 project is error free.
STEP 3: Modify the Employee Class
Back to Top
1. Modify the class declaration of the Employee class to specify that the Employee class is an abstract class
2. Declare an abstract method called CalculateNetPay that returns a double value.
3. Modify the ToString Method to include the weekly net pay in currency format.
STEP 4: Modify the Salaried Class
Back to Top
1. Add a double constant called TAX_RATE and set the value to .73
2. Implement the CalculateNetPay method by multiplying the weekly pay by the tax rate.
STEP 5: Modify the Hourly Class
Back to Top
1. Add a double constant called TAX_RATE and set the value to .82
2. Implement the CalculateNetPay method by multiplying the weekly pay by the tax rate.
STEP 6: Create the Main Program
Back to Top
1. Change the employeeList array to only hold two objects
2. Create one Hourly employee object and store it in the array.
3. Create one Salaried employee object and store it in the array.
4. As you did in the Week 5 lab, prompt for and collect the information for each of the objects.
Note: iterating through the array should not require any changes from the previous iteration of the project--but make sure that the loop stays within the bounds of the array.
STEP 7: Compile and Test
Back to Top
When done, compile and run your program.
Then debug any errors until your code is error-free.
Check your output to ensure that you have the desired output and modify your code as necessary and rebuild.
The output of your program should resemble the following: