C# HW
Mbahattab
HONOR CODE
COMP-3040-02
Data Structures
Assignment-2
Due on 02/04/2016
I pledge my honor that I have neither given nor received aid on this work. Do not sign until after you have completed your assignment.
|
|
Name: |
Signature:
|
COMP3040-02 Data Structures Assignment 2
Due 9/16/2015
1. Unsorted Array of objects
· Download and study program P2-1, build and run it. (Do not submit this screenshot)
· Modify program P2-1 so that it can do the same operations for an array of Employee (the class Employee is given at the end of this document)
The operations include:
· Search for an employee whose ID is given.
· Append an employee to the Employee array.
· Delete an employee with a specified ID
· Remove an employee from the array of Employee.
· Find the employee with highest salary (you need to add a method for this and add entry to the menu). Display the employee you found.
· Find the employee with the lowest salary (you need to add a method for this and add entry to the menu). Display the employee you found.
2. Sorted Array of objects
· Download and study program P2-2, build and run it. (Do not submit this screenshot)
· Modify program P2-2 so that it can do the same operations for an array of Employee (the class Employee is given at the end of this document)
The operations include:
· Search for an employee whose ID is given.
· Insert an employee to the Employee array.
· Delete an employee with a specified ID
· Find and display the employee with highest salary (you need to add the entry to the menu)
· Find display the employee with the lowest salary (you need to add the entry to the menu)
Requirement for assignment reports
1. There must be a cover page, including the name, date of the submission and assignment questions.
2. For each programming question, the submission must contain the program itself directly printed from visual studio, description of the input and output of each operation, and running page (screen shot) which shows that the program works for all cases.
3. Add proper comments lines as necessary so that the instructors can read and understand the program.
The definition of the class Employee is at next page.
class Employee
{
public string name;
public int empID;
public double salary;
public void Input()
{
Console.Write("Name: ");
name = Console.ReadLine();
Console.Write("ID: ");
empID = int.Parse(Console.ReadLine());
Console.Write("Salary: ");
salary = double.Parse(Console.ReadLine());
}
public Output()
{
Console.WriteLine("[{0}|{1}|{2:C}]", name, empID, salary);
}
}