forked from Dverma1650/Hacktoberfest_2020
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stuC#
159 lines (159 loc) · 3.61 KB
/
stuC#
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
using System;
using System.Collections.Generic;
namespace ConsoleApplication1
{
class Person
{
public string name;
}
class Teacher : Person
{
public void Show()
{
Console.WriteLine("Teacher Name is :{0} and qualification is :{1}", (name, qualification);
}
public string qualification;
}
class Student:Person
{
public string stream;
public string rollno;
}
class Exams:Student
{
public Dictionary<string, double> sub = new Dictionary<string, double>();
}
interface Talents
{
public void Show();
}
class Awards:Exams,Talents
{
public List<string> talents = new List<string>();
public void Show()
{
Console.WriteLine("Student Name is {0} and roll no is {1}", name, rollno);
Console.WriteLine("Student's Stream is {0} ", stream);
foreach (KeyValuePair<string,double>subject in sub)
{
Console.WriteLine("{0} and {1}", subject.Key, subject.Value);
}
Console.WriteLine("Student Talents are :");
foreach(string tal in talents)
{
Console.WriteLine(tal);
}
}
}
class Program
{
static void Main(string[] args)
{
Teacher t = new Teacher();
Awards a = new Awards();
Console.WriteLine("Enter the name of Teacher :");
t.name = Console.ReadLine();
Console.WriteLine("Enter the qualification:");
t.quali = Console.ReadLine();
Console.WriteLine("Enter the student name:");
a.name = Console.ReadLine();
Console.WriteLine("Enter the Student Rollno:");
a.rollno = Console.ReadLine();
Console.WriteLine("Enter Student Stream:");
a.stream = Console.ReadLine();
Console.WriteLine("Enter the Subject Name:");
int num = Convert.ToInt32(Console.ReadLine());
while (num > 0)
{
Console.WriteLine("Subject:");
String s = Console.ReadLine();
Console.WriteLine("Enter marks in {0}:",s);
a.sub.Add(s, Convert.ToDouble(Console.ReadLine()));
num--;
}
Console.WriteLine("Enter the talents:");
a.talents.AddRange(Console.ReadLine().Split(''));
t.Show();
a.Show();
}
}using System;
using System.Collections.Generic;
namespace ConsoleApplication1
{
class Person
{
public string name;
}
class Teacher : Person
{
public void Show()
{
Console.WriteLine("Name of teacher is :{0} and qualification is :{1}", name, qualification);
}
public string qualification;
}
class Student : Person
{
public string stream;
public string rollno;
}
class Exams : Student
{
public Dictionary<string, double> sub = new Dictionary<string, double>();
}
interface Talents
{
public void Show();
}
class Awards : Exams, Talents
{
public List<string> talents = new List<string>();
public void Show()
{
Console.WriteLine("Student Name is {0} and roll no is {1}", name, rollno);
Console.WriteLine("Student Stream is {0} ", stream);
foreach (KeyValuePair<string, double> subject in sub)
{
Console.WriteLine("{0} and {1}", subject.Key, subject.Value);
}
Console.WriteLine("Talent of student are:");
foreach (string tal in talents)
{
Console.WriteLine(tal);
}
}
}
class Program
{
static void Main(string[] args)
{
Teacher t = new Teacher();
Awards a = new Awards();
Console.WriteLine("Enter the teacher name:");
t.name = Console.ReadLine();
Console.WriteLine("Enter the qualification:");
t.quali = Console.ReadLine();
Console.WriteLine("Enter the student name:");
a.name = Console.ReadLine();
Console.WriteLine("Enter the student rollno :");
a.rollno = Console.ReadLine();
Console.WriteLine("Enter the student Stream:");
a.stream = Console.ReadLine();
Console.WriteLine("Enter the number of subjects:");
int num = Convert.ToInt32(Console.ReadLine());
while (num > 0)
{
Console.WriteLine("Subject:");
String s = Console.ReadLine();
Console.WriteLine("Enter marks in {0}:", s);
a.sub.Add(s, Convert.ToDouble(Console.ReadLine()));
num--;
}
Console.WriteLine("Enter the talents:");
a.talents.AddRange(Console.ReadLine().Split(''));
t.Show();
a.Show();
}
}
}
}