-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.cs
More file actions
56 lines (50 loc) · 1.52 KB
/
Student.cs
File metadata and controls
56 lines (50 loc) · 1.52 KB
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ClassInheritance2
{
internal class Student :User
{
public string Faculty { get; set; }
public Dictionary<string, int> AcademicPerformance;
public Student(string univer, string fio, string faculty) :base(univer, fio)
{
Faculty = faculty;
AcademicPerformance = new Dictionary<string, int>();
}
public void AddSubject( string subjectName, int grade)
{
AcademicPerformance.Add(subjectName, grade);
}
public void DeleteSubject(string subjectName)
{
AcademicPerformance.Remove(subjectName);
}
public void SetGrade(string subjectName, int grade)
{
bool flag = false;
foreach (var key in AcademicPerformance.Keys)
{
if (key == subjectName)
{
AcademicPerformance[key] = grade;
}
flag = true;
break;
}
if (!flag)
Console.WriteLine("Subject is not found.");
}
public override void PrintInfo()
{
base.PrintInfo();
Console.WriteLine($"Fuculty: {Faculty}");
foreach (var key in AcademicPerformance.Keys)
{
Console.WriteLine($"subjectName: {key} - {AcademicPerformance[key]}");
}
}
}
}