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

C# only please Create a program that includes the following requirements: Create

ID: 3570358 • Letter: C

Question

C# only please

Create a program that includes the following requirements: Create an employee class  

Private class members for:

an array of 5 integer employee ids

an array of 5 string last names

an array of 5 string first names

an array of 5 double pay rates

other class variables as needed

Public class methods:

a method to fill all four employee info parallel arrays by keyboard inputs

the fill employee info method will take entries for employee ID, employee first name, employee last name, employee pay that will fill each array. For the employee ID entry, when the ID number is entered you will check the ID array for a duplicate ID and prompt the user to reenter the employee ID

a method to search the parallel arrays either by id number, by last name or by hourly pay

a console menu asking which choice is desired, id, last name, or hourly pay

use a selection structure to evaluate the option entered and call one of three class methods:

search for ID

search for last name

search for pay

default will be to display "Sorry - invalid option"

for each of the three search methods called from the search employees method you will:

prompt the user to enter the ID number, or last name, or pay depending on which method is called

take the input (ID, last name, pay) for the processing search method and use a loop to find the ID, last name, or pay that was entered for the corresponding search method

when a match is found display all corresponding (parallel) information for the found employee info

if the entered id, last name or pay are not found then display "Sorry - no employee with (entered ID, name, or pay) + the value entered

In Main:

Instantiate one new employee object

call the class method that will fill the employees array

a sentinel loop with a sentinel variable that will be initialized to character Y and a conditional that will continue while the sentinel is not equal to 'N' or 'n'

in the loop call the search employees class method

accept an entry from the keyboard to allow the user to make selections until an n or an N is entered

when an N or an n is entered terminate the while loop

Possible output might look like this:

Enter ID number for employee #1 1
Enter the first name for employee with ID#1 dick
Enter the last name stutte
Enter the pay rate 11
Enter ID number for employee #2 1
Duplicate ID - please reenter Enter ID number for employee #2 2
Enter the first name for employee with ID#2 jack
Enter the last name spratt
Enter the pay rate 22
Enter ID number for employee #3 3
Enter the first name for employee with ID#3 jane
Enter the last name doe
Enter the pay rate 33
Enter ID number for employee #4 4
Enter the first name for employee with ID#4 tom
Enter the last name thumb
Enter the pay rate 44
Enter ID number for employee #5 5
Enter the first name for employee with ID#5 no
Enter the last name name
Enter the pay rate 55


Do you want to see employees by:
(1) ID number
(2) Last name
(3) Hourly pay
Please enter your choice ---> 1
Which employee's record do you want to see? -- Enter ID number 6
Sorry - no employee with ID#6
Do you want to search again? Yes (Y/y) or No (N/n)---> Y
Do you want to see employees by:
(1) ID number
(2) Last name
(3) Hourly pay
Please enter your choice ---> 1
Which employee's record do you want to see? -- Enter ID number 3
ID#3 jane doe $33
Do you want to search again? Yes (Y/y) or No (N/n)---> y
Do you want to see employees by:
(1) ID number
(2) Last name
(3) Hourly pay
Please enter your choice ---> 2
Which employee's record do you want to see? -- Enter Last name williams
Sorry - no employee with name williams
Do you want to search again? Yes (Y/y) or No (N/n)---> y
Do you want to see employees by:
(1) ID number
(2) Last name
(3) Hourly pay
Please enter your choice ---> 2
Which employee's record do you want to see? -- Enter Last name spratt
ID#2 jack spratt $22
Do you want to search again? Yes (Y/y) or No (N/n)---> Y
Do you want to see employees by:
(1) ID number
(2) Last name
(3) Hourly pay
Please enter your choice ---> 3
Which employee's record do you want to see? -- Enter salary 12
ID#4 tom thumb $12
Do you want to search again? Yes (Y/y) or No (N/n)---> n
Press any key to continue . . .

Explanation / Answer

Here I am displaying all employee records

using System;

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

namespace EmployeeIndexer
{
class Program
{
static void Main(string[] args)
{

while (true)
{
Console.Clear();
Console.WriteLine("Menu");
Console.WriteLine("====");
Console.WriteLine("1.Add an Employee Record");
Console.WriteLine("2.Display Employee Record(s)");
Console.WriteLine("3.Exit");

Console.WriteLine("Enter your choice");
int ch = Int32.Parse(Console.ReadLine());
switch (ch)
{
case 1:
Employee_List emplist = new Employee_List();
emplist.AddEmployee();
break;
case 2:
for (int i = 0; i < 10; i++)
{
Console.WriteLine();
}
break;

}
}
}
}

class Employee
{
string ename,edept;
int eno,esal;

public Employee()
{
ename="";
edept="";
eno=0;
esal=0;
}

public Employee(string name,string dept,int num,int sal)
{
ename=name;
edept=dept;
eno=num;
esal=sal;
}

public Employee this[int pos]
{
get
{
if(pos>0 && pos<=9)
{
return Employee;
}
  
}
}

  
  
}

class Employee_List
{
Employee[] emp=new Employee[10];
int index=0;

public void AddEmployee()
{
string name,dept;
int num,sal;

Console.WriteLine("Enter the details");
Console.WriteLine("NAME:");
name=Console.ReadLine();
Console.WriteLine("DEPARTMENT:");
dept=Console.ReadLine();
Console.WriteLine("EMPLOYEE NUMBER:");
num=Int32.Parse(Console.ReadLine());
Console.WriteLine("SALARY:");
sal=Int32.Parse(Console.ReadLine());

emp[index]=new Employee(name,dept,num,sal);
index++;

}
}

}

but we can search by individual by this, hope this will help you

Console.WriteLine(emp["Name"]);
public object this[string field]   
{
get
{
switch(field)
{
case "EmployeeNo": return eno;
case "Name": return ename;
case "Department": return edept;
case "Salary": return esal;
}
return null;
}
}