/
Program.cs
82 lines (78 loc) · 2.67 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System;
using OutstandingLibrary;
namespace OutStandingConsole
{
class Program
{
static void SubMenu()
{
Console.WriteLine(" 1.Professor");
Console.WriteLine(" 2.Student");
}
static int EnterChoice()
{
Console.WriteLine("Enter your choice");
return int.Parse(Console.ReadLine());
}
static OutClass Create(int choice)
{
OutClass outclass = null;
Console.WriteLine("enter the name");
string OutName = Console.ReadLine();
switch(choice)
{
case 1:
Console.WriteLine("enter the number of publications");
int publications = int.Parse(Console.ReadLine());
outclass = new Professor(OutName, publications);
break;
case 2:
Console.WriteLine("enter the marks");
int marks = int.Parse(Console.ReadLine());
outclass = new Student(OutName, marks);
break;
}
return outclass;
}
static void Main(string[] args)
{
OutClass[] outClasses = new OutClass[4];
for(int i=0;i<4;i++)
{
SubMenu();
int choice = EnterChoice();
OutClass oc = Create(choice);
outClasses[i] = oc;
}
foreach(OutClass e in outClasses)
{
if (e.IsOutstanding())
{
if (e is Professor)
{
Professor d = e as Professor;
/*if(d.IsOutstanding())
{
}
*/
Console.WriteLine($"The details of professor are {d.printvalues()}");
/*else
Console.WriteLine($"Sorry Sir You need more publications");
*/
}
if (e is Student)
{
Student s = e as Student;
/*if (s.IsOutstanding())
{
}*/
Console.WriteLine($"The details of students are {s.show()}");
/* else
Console.WriteLine("Sorry buddy you are not outstanding it seems");
*/
}
}
}
}
}
}