Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

CITP 4350 Midterm Create an “Employee” class with six fields: first name, last name, workID, yearStartedWked, initSalary, and curSalary. It includes constructor(s) and properties to initialize values...

1 answer below »
CITP 4350 Midterm
Create an “Employee” class with six fields: first name, last name, workID, yearStartedWked,
initSalary, and curSalary. It includes constructor(s) and properties to initialize values for all
fields (curSalary is read-only). It also includes a calcCurSalary function that assigns the
curSalary equal to initSalary.
Create a “Worker” classes that are derived from Employee class.
 In Worker class, it has one field, yearWorked. It includes constructor(s) and properties.
It also includes two functions: first, calcYearWorked function, it takes one parameter
(cu
entyear) and calculates the number of year the worker has been working (cu
ent
year–yearStartedWked) and save it in the yearWorked variable. Second, the
calcCurSalary function that calculate the cu
ent year salary by ove
iding the base class
function using initial salary with 3% yearly increment.
Create a “Manager” classes that are derived from Worker class.
 In Manager class, it includes one field: yearPromo. It includes the constructor(s) and
property. It also includes a calcCurSalary function that calculate the cu
ent year salary
y ove
iding the base class function using initial salary with 5% yearly increment plus
10% bonus. The manager’s salary calculates in two parts. It calculates as a worker
efore the year promoted and as a manager after the promotion.
Create an “EmployeeDemo” class. It includes three functions:
1. In the main function, the program calls the readData() function to get the data from file
and calls the objSort() function to sort the a
ay of objects. Then, the program prompts
user to enter the range of cu
ent salary that user want to see and display the employee’s
information whose cu
ent salary is in the range in a descending order.
2. readData(): it reads the workers and managers information from files (“worker.txt” and
“manager.txt”) and then creates the dynamic a
ays of objects to save the data. Then, it
prompts user for the cu
ent year to calculate the yearWorked and cu
entSalary.
3. objSort(): this function accepts an a
ay of object as a parameter and sort the a
ay by
cu
ent salary in descending order.
P.S.: In the text files, they include the number of people in the files at the beginning of the files.

5
Hecto
Alcose
A001231
1999
24000
Anna
Alaniz
A001232
2001
34000
Lydia
Bean
A001233
2002
30000
Jorge
Botello
A001234
2005
40000
Pablo
Gonzalez
A001235
2007
35000

3
Sam
Reza
M000411
1995
51000
2005
Jose
Perez
M000412
1998
55000
2002
Rachel
Pena
M000413
2000
48000
2010
Answered Same Day Oct 22, 2021

Solution

Arun Shankar answered on Oct 24 2021
137 Votes
main.cs
using System;
class MainClass
{
static Manager[] ma
;
static Worker[] wa
;
static int managerCount;
static int workerCount;
public static void readData()
{
System.IO.StreamReader file =
new System.IO.StreamReader(@"manager.txt");
string line = file.ReadLine();
managerCount = Int16.Parse(line);
ma
= new Manager[managerCount];
for(int i = 0; i < managerCount; i++)
{
string firstName = file.ReadLine();
string lastName = file.ReadLine();
string ID = file.ReadLine();
int yearStartedWked = Int16.Parse(file.ReadLine());
double salary = Double. Parse(file.ReadLine());
int yearPromoted = Int16.Parse(file.ReadLine());
ma
[i] = new Manager(firstName, lastName, ID, yearStartedWked, salary, yearPromoted);
}

file.Close();
file = new System.IO.StreamReader(@"worker.txt");
line = file.ReadLine();
workerCount = Int16.Parse(line);
wa
= new Worker[workerCount];
for(int i = 0; i < workerCount; i++)
{
string firstName = file.ReadLine();
string lastName = file.ReadLine();
string ID = file.ReadLine();
int yearStartedWked = Int16.Parse(file.ReadLine());
double salary = Double. Parse(file.ReadLine());
wa
[i] = new Worker(firstName, lastName, ID, yearStartedWked, salary);
}

file.Close();...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here