CIS247A Week 6 iLab Abstract Classes

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

STEP 1: Understand the UML Diagram
Analyse and understand the object UML diagram, which models the structure of the program.

  1. The Employee class has been specified as abstract, which is denoted by the name of the class being initialized Employee
  2. 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.
  3. 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_WK6_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 project
  4. Add the Week 5 project files to the appropriates 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 solution includes a Visual Studio (c#) project

  • Attachments [Move over files to preview content of those files]
    • (145.30 KB)
      • CIS247A-Week-6-Screenshot.png
      • Visual Studio project
        • CIS247A_WK6_Lab
          • CIS247A_WK6_Lab
          • CIS247A_WK6_Lab.sln
          • CIS247A_WK6_Lab.v12.suo
    Preview Benefit.cs
    xxxxxxx xxxxx xxxxxx xxx_xxxx_xxxxxxxxx = 1000;
    xxxxxxx xxxxx xxxxxx xxx_xxxx_xxxxxxxxx = 10000000;
    xxxxxxx xxxxx xxx xxx_xxxxxxxx = 0;
    xxxxxxx xxxxx xxx xxx_xxxxxxxx = 100;
    xxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxx;
    private double lifeInsuranceAmount; private int vacation; public Benefit() { vacation = MAX_VACATION; lifeInsuranceAmount = MAX_LIFE_INSURANCE; healthInsuranceCompany = DEFAULT_HEALTH_INSURANCE; } public Benefit(String health,double life,int vacat) { HealthInsuranceCompany = health; LifeInsuranceAmount = life;
    xxxxxxxx = xxxxx;
    xxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxx
    Preview Employee.cs
    xxxxxxxxx xxxxxx xxxxxxxx; //xxxx xxxx xx xxx xxxxxxxx
    xxxxxxxxx xxxx xxxxxx; //xxxxxx xx xxx xxxxxxxx
    xxxxxxxxx xxx xxxxxxxxxx; //xxxxxxxxx xx xxx xxxxxxxx
    xxxxxxxxx xxxxxx xxxxxxxxxxxx; //xxxxxx xxxxxx xx xxx xxxxxxxx
    protected const int MIN_DEPENDENTS = 0; //Default value for min dependants protected const int MAX_DEPENDENTS = 10; //Default value for max dependants protected const double MIN_SALARY = 20000; //Default value for min salary protected const double MAX_SALARY = 100000; //Default value for max salary protected const string DEFAULT_NAME = "not given"; //Default value for name protected const char DEFAULT_GENDER = 'U'; //Default value for gender protected static int numEmployees = 0; //Counter variablefor employee objects created so far //Benefit object public Benefit benefit; protected String employeeType;
    xxxxxx xxxxxxxx xxxxxx xxxxxxxxxxxxxxx();
    xxxxxx xxxxxx xxx xxxxxxxxxxxxxxx //xxxxxxxx xx xxx xxxxx xx xxxxxx xxxxxxxx xxxxxxxxxxxx
    xxx //xxxxxx xxx xxxxxxxxxxxx
    Preview Hourly.cs
    xxxxxxx xxxxx xxx xxx_xxxx = 10;
    xxxxxxx xxxxx xxx xxx_xxxx = 75;
    xxxxxxx xxxxx xxx xxx_xxxxx = 0;
    xxxxxxx xxxxx xxx xxx_xxxxx = 50;
    xxxxxxx xxxxx xxxxxx xxxxx_xxxxxxx = 10;
    private double wage; private double hours; private string category; public Hourly():base() { wage = 10; hours = 1; } public Hourly(String type):base(type) { wage = 10; hours = 1;
    xxxxxx xxxxxx(xxxxxx xxxxx, xxxxxx xxxx, xxxx xxx, xxx xxx, xxxxxx xxxxxx, xxxxxxx xxxxxxx, xxxxxx xxxxxxxxxxxx, xxxxxx xxxx,xxxxxx xxxxx,xxxxxx xxxxxxxx)
    : xxxx(xxxxx, xxxx, xxx, xxx, xxxxxx, xxxxxxx, xxxxxxxxxxxx)
    xxxx = xxxx;
    xxxxx = xxxxx;
    Preview Salaried.cs
    xxxxxxx xxxxx xxx xxx_xxxxxxxxxx_xxxxx = 3;
    xxxxxxx xxxxx xxxxxx xxxxx_xxxxxxx = 10;
    xxxxxxx xxxxx xxxxxx xxx_xxxx = 0.73;
    xxxxxxx xxx xxxxxxxxxxxxxxx;
    xxxxxx xxxxxxxx():xxxx()
    { managementLevel = 1; } public Salaried(String type) : base(type) { managementLevel = 1; } public Salaried(string first, string last, char gen, int dep, double salary, Benefit benefit, String employeeType,int manageLevel):base(first, last, gen, dep, salary, benefit, employeeType) { ManagementLevel = manageLevel; }
    xxxxxx xxx xxxxxxxxxxxxxxx
    xxxxxx xxxxxxxxxxxxxxx;
    Preview EmployeeInput.cs
    xxxxx xxxxxx;
    xxxxx xxxxxx.xxxxxxxxxxx.xxxxxxx;
    xxxxx xxxxxx.xxxx;
    xxxxx xxxxxx.xxxx;
    namespace CIS247A_WK6_Lab { public class EmployeeInput { public static void CollectEmployeeInformation(Employee theEmployee) {
    xxxxxxxxxxx.xxxxxxxxx = xxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxx("xxxxx xxxx"); //xxx xxxxx xxxx xxxxx xxxx xxx xxxx
    xxxxxxxxxxx.xxxxxxxx = xxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxx("xxxx xxxx");//xxx xxxx xxxx xxxxx xxxx xxx xxxx
    xxxxxxxxxxx.xxxxxx = xxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxx("xxxxxx");//xxx xxxxxx xxxxx xxxx xxx xxxx
    xxxxxxxxxxx.xxxxxxxxxx = xxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxx("# xxxxxxxxxx");//xxx xxxxxxxxx xxxxx xxxx xxx xxxx
    xxxxxxxxxxx.xxxxxxx.xxxxxxxxxxxxxxxxxxxxxx = xxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxx("xxxxxx xxxxxxxxx xxxxxxx");
    xxxxxxxxxxx.xxxxxxx.xxxxxxxxxxxxxxxxxxx = xxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxx("xxxx xxxxxxxxx xxxxxx");
    Preview EmployeeOutput.cs
    xxxxx xxxxxx;
    xxxxx xxxxxx.xxxxxxxxxxx.xxxxxxx;
    xxxxx xxxxxx.xxxx;
    xxxxx xxxxxx.xxxx;
    namespace CIS247A_WK6_Lab { public class EmployeeOutput { public static void DisplayEmployeeInformation(string employeeType) { ApplicationUtilities.DisplayDivider("Collect " + employeeType + " Information");
    xxxxxx xxxxxx xxxx xxxxxxxxxxxxxxxxxxxx()
    xxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxx(" xxxxxx xx xxxxxxxx xxxxxx(x): " + xxxxxxxx.xxxxxxxxxxxxxxx + " ");//xxxx xxxxx xxxxxx xx xxxxxxxx xxxxxxx xxxxxxx xx xxx
    Preview Program.cs
    xxxxx xxxxxx;
    xxxxx xxxxxx.xxxxxxxxxxx.xxxxxxx;
    xxxxx xxxxxx.xxxx;
    xxxxx xxxxxx.xxxx;
    xxxxx xxxxxx.xxxxxxxxx.xxxxx;
    namespace CIS247A_WK6_Lab { class Program { static void Main(string[] args) {
    xxxxxxxx[] xxxxxxxxxxxx = xxx xxxxxxxx[3];
    xxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxx(); //xxxxxxx xxx xxxxxx xxx xxx xxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxx("xxxxx xxxxxxx"); //xxxx xxxxxxx xxxx xxx xxxxxxx xxx xxxxxxx
    xxxxxxxxxxxx[0] = xxx xxxxxx("xxxxxx");
    Preview ApplicationUtilities.cs
    xxxxx xxxxxx;
    xxxxx xxxxxx.xxxxxxxxxxx.xxxxxxx;
    xxxxx xxxxxx.xxxx;
    xxxxx xxxxxx.xxxx;
    namespace CIS247A_WK6_Lab { public class ApplicationUtilities { public static void DisplayApplicationInformation() { Console.WriteLine("Welcome the Basic Employee Program");
    xxxxxxx.xxxxxxxxx("xxx247x, xxxx 6 xxx");
    xxxxxxx.xxxxxxxxx("xxxx: xxxx xxx");
    xxxxxxx.xxxxxxxxx("xxxx xxxxxxx xxxxxxx xxxx xxxxx xx x xxxxxx, xxxx xxxxx xxx \xxxxxxxxxxxx xxxx xxxxxxxxxx xxx xxxxxxx xxx xxxxx xx xxxxxxxx xxxxxxx xxxxx xxxxxxxxx xxx xxxxxxxx.");
    xxxxxx xxxxxx xxxx xxxxxxxxxxxxxx(xxxxxx xxxxxxxxxxx)
    Preview InputUtilities.cs
    xxxxxx xxxxxxxx = xxxxxx.xxxxx;
    xxxxxxx.xxxxx("xxxxx xxx " + xxxxxxxxx + ": ");
    xxxxxxxx = xxxxxxx.xxxxxxxx();
    return strInput; } public static string getStringInputValue(string inputType) { string value = String.Empty; bool valid = false; string inputString = String.Empty; do { inputString = GetInput(inputType); if (!String.IsNullOrEmpty(inputString)) {
    xxxxx = xxxxxxxxxxx;
    xxxxx = xxxx;
    xxxxx = "xxxxxxx xxxxx";

Price: $15 $20 Save $5 (25%)

Buy Now

Add to Cart

Note: We offer a discount for buyers who purchase multiple items.