C1S247 Lab 6 in C# – Guaranteed 100% score
iLab 6 of 7: Abstract Classes
i L A B O V E R V I E W
Scenario and Summary
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:
• Before you post your lab in the dropbox, copy your entire program into a Notepad file and post that. I do not need you to zip the project or give me screen shots of the output.
i L A B S T E P S
STEP 1: Understand the UML Diagram
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
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
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
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
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
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
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:
On-screen output display:
Welcome the Employee Hierarchy Program
CIS247, Week 5 Lab
Name: Solution
This program tests an Employee inheritance hierarchy
*********************** Display Employee’s Data **********************
Employee Type Hourly
First Name Mary
Last Name Noia
Dependents 4
Annual Salary $100,000
Weekly Pay $2,080.00
Net Pay $1,705.00
Health Insurance Blue Cross
Life Insurance $175,000
Vacation 24
Hours 40
Wage 52
Category Full Time
*********************** Display Employee’s Data **********************
Employee Type Salaried
First Name Sue
Last Name Smith
Gender Female
Dependents 2
Annual Salary $100,000.00
Weekly Pay $2,500.00
Net Pay $1,855.00
Health Insurance Blue Cross
Life Insurance $300,000
Vacation 15
Level 3
total Number of Employess in Database: 2
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.