Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

EmployeeInfo.txt CITP 3310 Assignment 6 Create a class object called \"Employee\

ID: 3736103 • Letter: E

Question

EmployeeInfo.txt CITP 3310 Assignment 6 Create a class object called "Employee" which included six private variables: First Name Last Name ID number . Initial Salary Start Year Current Salary Methods: . . . Constructors Properties (curSalary is a read-only) CacCurSalary():Calculate the current salary based on a 5% yearly increment from the startYear. Create an "EmployeeDemo" class. In the main function, the program prompts user to enter the current year. Then, the program reads three company employee information from the "Employeelnfo.txt file and save the data into three objects After saving the data, the program prompts user to enter the range of current salary that you want to see and display the employee's information whose current salary is in the range in a descending order.

Explanation / Answer

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
//Rextester.Program.Main is the entry point for your code. Don't change it.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace Rextester
{
class Employee
{
string m_firstName;
string m_lastName;
string m_idNumber;
int m_initialSalary;
int m_startYear;
float m_currentSalary;


//coustructors
public Employee()
{

}

public Employee(string firstName, string lastName, string idNumber, int initialSalary, int startYear)
{
m_firstName = firstName;
m_lastName = lastName;
m_idNumber = idNumber;
m_initialSalary = initialSalary;
m_startYear = startYear;
}

//mutatores
public string FirstName
{
get { return m_firstName; }
set { m_firstName = value; }

}

public string LastName
{
get { return m_lastName; }
set { m_lastName = value; }

}

public string IdName
{
get { return m_idNumber; }
set { m_idNumber = value; }

}

public int InitialSalary
{
get { return m_initialSalary; }
set { m_initialSalary = value; }

}

public int StartYear
{
get { return m_startYear; }
set { m_startYear = value; }

}

public float CurrentSalary
{
get { return m_currentSalary; }
}

public void CalCurrentSalary(int currentYear)
{
int yearDifference = currentYear - m_startYear;
float currentSal = m_initialSalary;
int i = 0;
while (i < yearDifference)
{
currentSal = currentSal + currentSal * 5 / 100;
i++;
}

m_currentSalary = currentSal;
}
}

public class EmployeeDemo
{
public static void Main(string[] args)
{
//Your code goes here
int year;
Console.WriteLine("Enter the current year");
year = Convert.ToInt32(Console.ReadLine());
  
// Read each line of the file into a string array. Each element
// of the array is one line of the file.
string[] lines = System.IO.File.ReadAllLines(@"EmployeeInfo.txt");

  

Employee[] empArray = new Employee[3];

int i = 0;
int counter = 0;
while(counter<lines.Length)
{
Employee emp = new Employee();

emp.FirstName = lines[counter];
counter++;

emp.LastName = lines[counter];
counter++;

emp.IdName = lines[counter];
counter++;

emp.StartYear = Convert.ToInt32(lines[counter]);
counter++;

emp.InitialSalary = Convert.ToInt32(lines[counter]);
counter++;

empArray[i] = emp;
i++;
}

foreach (Employee emp in empArray)
{
emp.CalCurrentSalary(year);
}

System.Console.WriteLine("Enter the range of current sal= ");
int r = Convert.ToInt32(Console.ReadLine());

foreach (Employee emp in empArray)
{
if (emp.CurrentSalary <= r)
{
System.Console.WriteLine("Employee name {0} {1}, id {2}, start year {3}, inital salary {4}, current salary {5}",
emp.FirstName,emp.LastName,emp.IdName,emp.StartYear,emp.InitialSalary,emp.CurrentSalary);
}
}

// Console.ReadKey();
}
}
}
}

//PLEASE PROVIDE FEEDBACK THUMBS UP

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote