Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Code: - / / / Employee.cs / / / using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MyNamespace { public class Employee
Code:
Employee.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyNamespace
public class Employee
private string firstName;
public string FirstName
get return firstName;
set firstName value;
private string lastName;
public string LastName
get return lastName;
set lastName value;
private int wordId;
public int WordId
get return wordId;
set wordId value;
private int yearStartedWked;
public int YearStartedWked
get return yearStartedWked;
set yearStartedWked value;
private double initSalary;
public double InitSalary
get return initSalary;
set initSalary value;
public Employee
firstName ;
lastName ;
wordId ;
yearStartedWked ;
initSalary ;
public Employeestring fN string lN int id int yearStarted, double salary
firstName fN;
lastName lN;
wordId id;
yearStartedWked yearStarted;
initSalary salary;
SalaryCalculate.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyNamespace
public interface SalaryCalculate
void CalcYearWorkedint currentYear;
void CalcCurSalaryint currentYear;
Worker.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyNamespace
public class Worker : Employee, SalaryCalculate
private int nYearWked;
public int NYearWked
get return nYearWked;
set nYearWked value;
private double curSalary;
public double CurSalary
get return curSalary;
set curSalary value;
public Workerstring fN string lN int id int yearStarted, double salary : basefN lN id yearStarted, salary
public void CalcYearWorkedint currentYear
nYearWked currentYear YearStartedWked;
public void CalcCurSalaryint currentYear
double salary InitSalary;
for int i YearStartedWked; i currentYear; i
salary ;
CurSalary salary;
Manager.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyNamespace
public class Manager : Worker
private int yearPromo;
public int YearPromo
get return yearPromo;
set yearPromo value;
public Managerstring fN string lN int id int yearStarted, double salary, int yearPromo
: basefN lN id yearStarted, salary
this.yearPromo yearPromo;
public void CalcCurSalaryint currentYear
double salary InitSalary;
for int i YearStartedWked; i currentYear; i
if i yearPromo
salary ;
else
salary ;
CurSalary salary ; bonus
Main.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace MyNamespace
class EmployeeMain
public static void Main
List employees new List;
using StreamReader sr new StreamReadernew FileStreamworkertxt FileMode.Open
string line;
whileline srReadLine null
string words line.Split;
employees.Addnew Workerwords words Convert.ToIntwords Convert.ToIntwords Convert.ToDoublewords;
List managers new List;
using StreamReader sr new StreamReadernew FileStreammanagertxt FileMode.Open
string line;
while line srReadLine null
string words line.Split;
managers.Addnew Managerwords words Convert.ToIntwords Convert.ToIntwords Convert.ToDoublewords Convert.ToIntwords;
Console.WriteEnter current year: ;
int year Convert.ToIntConsoleReadLine;
for int i ; i employees.Count; i
employeesiCalcYearWorkedyear;
employeesiCalcCurSalaryyear;
Console.WriteLineWorker: employeesiLastName employeesiFirstName s salary is: employeesiCurSalary and worked a total of employeesiNYearWked years.";
for int i ; i managers.Count; i
managersiCalcYearWorkedyear;
managersiCalcCurSalaryyear;
Console.WriteLineManager: managersiLastName managersiFirstName s salary is: managersiCurSalary and worked a total of managersiNYearWked years.";
manager.txt
Sam Reza
Jose Perez
Rachel Pena
worker.txt
Hector Alcoser
Anna Alaniz
Lydia Bean
Jorge Botello
Pablo Gonzalez
I need to compile this in vs code for C#
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started