Question: Design, code, and test an Employee Payroll app using the Student Database app as a template. - Use a Console App (.NET Framework) workflow project

Design, code, and test an Employee Payroll app using the Student Database app as a template.

- Use a Console App (.NET Framework) workflow project type in VisualStudio

- Database storage must use a plain text (UTF-8) file - no database software allowed

- Use this Employee inheritance hierarchy data object classes down below - PayrollSystem code.

//Fig. 12.9: PayrollSystemTest.cs

// Employee hierarchy test app.

using System;

using System.Collections.Generic;

class PayrollSystemTest

{

static void Main()

{

// create derived-class objects

var salariedEmployee = new SalariedEmployee("John", "Smith",

"111-11-1111", 800.00M);

var hourlyEmployee = new HourlyEmployee("Karen", "Price",

"222-22-2222", 16.75M, 40.0M);

var commissionEmployee = new CommissionEmployee("Sue", "Jones",

"333-33-3333", 10000.00M, .06M);

var basePlusCommissionEmployee =

new BasePlusCommissionEmployee("Bob", "Lewis",

"444-44-4444", 5000.00M, .04M, 300.00M);

Console.WriteLine("Employees processed individually: ");

Console.WriteLine($"{salariedEmployee} earned: " +

$"{salariedEmployee.Earnings():C} ");

Console.WriteLine(

$"{hourlyEmployee} earned: {hourlyEmployee.Earnings():C} ");

Console.WriteLine($"{commissionEmployee} earned: " +

$"{commissionEmployee.Earnings():C} ");

Console.WriteLine($"{basePlusCommissionEmployee} earned: " +

$"{basePlusCommissionEmployee.Earnings():C} ");

// create List and initialize with employee objects

var employees = new List() {salariedEmployee,

hourlyEmployee, commissionEmployee, basePlusCommissionEmployee};

Console.WriteLine("Employees processed polymorphically: ");

// generically process each element in employees

foreach (var currentEmployee in employees)

{

Console.WriteLine( ); // invokes ToString

// determine whether element is a BasePlusCommissionEmployee

if (currentEmployee is BasePlusCommissionEmployee)

{

// downcast Employee reference to

// BasePlusCommissionEmployee reference

var employee = (BasePlusCommissionEmployee) currentEmployee;

employee.BaseSalary *= 1.10M;

Console.WriteLine("new base salary with 10% increase is: " +

$"{employee.BaseSalary:C}");

}

Console.WriteLine($"earned: {currentEmployee.Earnings():C} ");

}

// get type name of each object in employees

for (int j = 0; j < employees.Count; j++)

{

Console.WriteLine(

$"Employee {j} is a {employees[j].GetType()}");

}

}

}

- Name your project and solution EmpDB - this will create the EmpDB namespace - all code should be placed in that namespace

- Create at least 2 employees of each subtype for sample data in your input file - a total of 8 various employees.

- Employee objects in the database app should be stored in a List<> at runtime - not in a static sized array.

- Your EmpDB app should implement all 4 CRUD (Create, Read, Update, Delete) operations on Employee(s) in addition to processing payroll.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!