PRN211_-_SU_2022_-_PE_-_Trial_2146.webp
H

PRN211_-_SU_2022_-_PE_-_Trial_2146.webp

Question 1. (4 points)
You are asked to write a console application that includes public Student and Course classes.
The Student class contains (1 point):
Two public properties (not public fields): StudentID (int) and StudentName (string).
Necessary constructors (The code on line 13, 16, 17, 25 of function Main below must work).
And other methods if you need.
The Course class contains:
(0.5 point) Two public properties (not public fields): CourseID (int), CourseTitle(string), the private field (not public) has type Dictionary<Student, double>.
The Dictionary<Student, double> cover the list of students participating in the course and their GPA in this course.
(0.5 point) Necessary constructors (The code on line 14 of function Main below must work).
(1 point) Two public method:
void AddStudent(Student p, double g) to add student [p] with GPA as [g] to the course.
Void RemoveStudent(int StudentID) to remove student has id that equal [StudentID] from the course.
(0.5 point) The public override function ToString() to return string that present all information about the course: id, title, list of students and their GPA. (The code on line 18, 21, 27 of function Main below must work).
(0.5 point) The public event OnNumberOfStudentChange that is raised when the number of students of the course changes (it means when adding or removing student).
With the main function given in Figure 1 below, your code must have the same result as the Figure 2.
(You can find this code in the Given Materials.)
static void Notify(int oldNumber, int newNumber)
{ Console.WriteLine($"Number of student has changed from (oldNumber} to {newNumber}.");
}
O references
static void Main(string[] args)
{
Zoom
Student s new Student(1, "Trung");
Course c new Course (1, "PRN211_Sum21");
11
12
13
14
+ 100%
Close
Chưa có bình luận nào.

Thông tin

Category
PRN221
Thêm bởi
Hồng Anh
Ngày thêm
Lượt xem
321
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
PRN211_-_SU_2022_-_PE_-_Trial_2146.webp
File size
256.6 KB
Dimensions
960px x 1056px

Share this media

Back
Bên trên Bottom