In: Computer Science
In C#
Create classes: Person, Student, Employee, Professor, Staff and Address
In the Main Method, create three Lists for (Student, Staff, and Professor) with hard-coded data for at least 4 entries each.
Implement the menu driven CONSOLE logic taking a user input as:
Press 1 to modify Student
Press 2 to modify Staff
Press 3 to modify Professor
Press 0 to exit program
☐modify Student Menu Press 1 to list all students Press 2 to add a new student Press 3 to update … Press 4 to delete … Press 5 to return to main menu |
☐ modify Staff Menu Press 1 to list all Staff Press 2 to add a new Staff Press 3 to update … Press 4 to delete … Press 5 to return to main menu |
☐modify Professor Menu Press 1 to list all Professors Press 2 to add a new Professor Press 3 to update … Press 4 to delete … Press 5 to return to main menu |
☐ Console application must have a hierarchy of above-shown menus and run continuously until the person quits the application
☐ To list, add, update and delete to a list one must use LINQ.
using System;
namespace A {
class Student {
private string code = "Not Applicable";
private string name = "not known";
private int age = 0;
// Declare a Code property of type string:
public string Code {
get {
return code;
}
set {
code = value;
}
}
// Declare a Name property of type string:
public string Name {
get {
return name;
}
set {
name = value;
}
}
// Declare a Age property of type int:
public int Age {
get {
return age;
}
set {
age = value;
}
}
public override string ToString() {
return "Code = " + Code +", Name = " + Name + ", Age = " + Age;
}
}
class ExampleDemo {
public static void Main() {
// Creating a new Student object:
Student s = new Student();
// Setting code, name and the age of the student
s.Code = "001";
s.Name = "Abcd";
s.Age = 9;
Console.WriteLine("Student Info: {0}", s);
//let us increase age
s.Age += 1;
Console.WriteLine("Student Info: {0}", s);
Console.ReadKey();
}
}
}