From ab014ad20ad3bbaec966ab9055d5d89e685946f9 Mon Sep 17 00:00:00 2001 From: Season4 <872318548@qq.com> Date: Fri, 26 Jun 2015 16:53:46 +0800 Subject: [PATCH 1/7] text555 --- SRSDEMO/SRSDEMO.UI.Console/SRS.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SRSDEMO/SRSDEMO.UI.Console/SRS.cs b/SRSDEMO/SRSDEMO.UI.Console/SRS.cs index a595f4e..d4136d8 100644 --- a/SRSDEMO/SRSDEMO.UI.Console/SRS.cs +++ b/SRSDEMO/SRSDEMO.UI.Console/SRS.cs @@ -251,10 +251,10 @@ static void Main(string[] args) EnrollFlags result = sec2_1.Enroll(s1); - //题3: + - //题4: + From 72fe2745cd61fdddeea621a34dbcf895a94dbecb Mon Sep 17 00:00:00 2001 From: Season4 <872318548@qq.com> Date: Mon, 29 Jun 2015 11:53:09 +0800 Subject: [PATCH 2/7] 09123844 --- SRSDEMO/SRSDEMO.UI.Console/SRS.cs | 71 ++++++++++++++++++++++++++----- 1 file changed, 60 insertions(+), 11 deletions(-) diff --git a/SRSDEMO/SRSDEMO.UI.Console/SRS.cs b/SRSDEMO/SRSDEMO.UI.Console/SRS.cs index d4136d8..a126c00 100644 --- a/SRSDEMO/SRSDEMO.UI.Console/SRS.cs +++ b/SRSDEMO/SRSDEMO.UI.Console/SRS.cs @@ -10,8 +10,9 @@ class SRS //课程列表 public static ScheduleOfClasses scheduleOfClasses = new ScheduleOfClasses("SP2009"); - public static ScheduleOfClasses scheduleOfClasses1 = - new ScheduleOfClasses("SM2009"); + //练习1,增加第二学期课表 + public static ScheduleOfClasses scheduleOfClasses2 = new ScheduleOfClasses("SM2009"); + //教授、学生、课程列表 public static List faculty; // Generic List of Professors public static List studentBody; // Generic List of Students @@ -204,7 +205,8 @@ static void Main(string[] args) // Semester is finished (boy, that was quick!). Professors // assign grades. - sec1.PostGrade(s1, "C+"); + //练习1,令学生s1的c1课程选修不及格 + sec1.PostGrade(s1, "E"); sec1.PostGrade(s3, "A"); sec2.PostGrade(s2, "B+"); sec7.PostGrade(s2, "A-"); @@ -241,21 +243,68 @@ static void Main(string[] args) Console.WriteLine(""); s3.Display(); - //练习14.2 + //练习1 Section sec2_1, sec2_2, sec2_3, sec2_4, sec2_5; + + // 通过调用Course对象的ScheduleSection方法生成一个Section对象,相当于给某门课建立一个排课 + sec2_1 = c1.ScheduleSection("M", "8:10 - 10:00 PM", "GOVT101", 30); - sec2_1 = c1.ScheduleSection("W", "6:10 - 8:00 PM", "GOVT202", 30); - scheduleOfClasses1.AddSection(sec1); - scheduleOfClasses1.AddSection(sec2); - //题2:让s1选sec2 - EnrollFlags result = sec2_1.Enroll(s1); + sec2_2 = c2.ScheduleSection("TU", "8:10 - 10:00 PM", "GOVT102", 30); + sec2_3 = c3.ScheduleSection("W", "8:10 - 10:00 PM", "GOVT103", 30); + sec2_4 = c4.ScheduleSection("TH", "8:10 - 10:00 PM", "GOVT104", 30); + sec2_5 = c5.ScheduleSection("F", "8:10 - 10:00 PM", "GOVT105", 30); + + //将Section加入到选课列表中 + + scheduleOfClasses2.AddSection(sec2_1); + scheduleOfClasses2.AddSection(sec2_2); + scheduleOfClasses2.AddSection(sec2_3); + scheduleOfClasses2.AddSection(sec2_4); + scheduleOfClasses2.AddSection(sec2_5); + + //设定每门课的教师 + + p3.AgreeToTeach(sec2_1); + p2.AgreeToTeach(sec2_2); + p1.AgreeToTeach(sec2_3); + p3.AgreeToTeach(sec2_4); + p1.AgreeToTeach(sec2_5); + + Console.WriteLine("\n The second semester! \n"); + + + //模拟学生第二学期选课 + + //将学生s1的课程c1第一学期的成绩修改为E,这代表学生s1没通过课程c1 + Console.WriteLine("Student " + s1.Name + + " is attempting to enroll in " + + sec2_2.ToString()); + EnrollFlags status1 = sec2_2.Enroll(s1); - + ReportStatus(status1); + + Console.WriteLine(""); + //学生s3的课程c1第一学期的成绩是A,课程通过,s3可以选择课程c2 + + Console.WriteLine("Student " + s3.Name + + " is attempting to enroll in " + + sec2_2.ToString()); - + status1 = sec2_2.Enroll(s3); + ReportStatus(status1); + + + //第二学期课表 + Console.WriteLine(""); + Console.WriteLine("===================="); + Console.WriteLine("Schedule of Classes(the second semester):"); + Console.WriteLine("===================="); + Console.WriteLine(""); + scheduleOfClasses2.Display(); + Console.ReadKey(); From 833a001de8fc1a7ab80707d850f052c6ee0d5a86 Mon Sep 17 00:00:00 2001 From: Season4 <872318548@qq.com> Date: Mon, 29 Jun 2015 12:09:46 +0800 Subject: [PATCH 3/7] 09123844(2) --- SRSDEMO/SRSDEMO.UI.Console/model/Course.cs | 37 ++++++++++++++++++---- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/SRSDEMO/SRSDEMO.UI.Console/model/Course.cs b/SRSDEMO/SRSDEMO.UI.Console/model/Course.cs index 6d6d171..fcd7cc4 100644 --- a/SRSDEMO/SRSDEMO.UI.Console/model/Course.cs +++ b/SRSDEMO/SRSDEMO.UI.Console/model/Course.cs @@ -31,6 +31,7 @@ public Course(string cNo, string cName, double credits) { // Auto-implemented properties. //------------------------------- + public static int sectionnum = 0; public string CourseNumber { get; set; } public string CourseName { get; set; } public double Credits { get; set; } @@ -76,8 +77,16 @@ public override string ToString() { //************************************** // - public void AddPrerequisite(Course c) { - Prerequisites.Add(c); + public void AddPrerequisite(Course c) + { + if (this != c) + { + Prerequisites.Add(c); + } + else + { + Console.WriteLine("γ̱Լ޿Σ"); + } } //************************************** @@ -97,12 +106,28 @@ public Section ScheduleSection(string day, string time, string room, int capacity) { // Create a new Section (note the creative way in // which we are assigning a section number) ... - Section s = new Section(OfferedAsSection.Count + 1, - day, time, this, room, capacity); - + //ϰ4 Ϊ˱֤ѡκŶһ + sectionnum = sectionnum + 1; + Section s = new Section(sectionnum, + day, time, this, room, capacity); + // ... and then add it to the List OfferedAsSection.Add(s); - + return s; + } + + + + //ϰ4 + public void CancelSection(Section s) + { + //γ̴ѡƳ + OfferedAsSection.Remove(s); + //ѡѡαƳ + s.OfferedIn.SectionsOffered.Remove(s.RepresentedCourse.CourseNumber + + " - " + s.SectionNumber); + + Console.WriteLine("γƳѡα"); } } From 6f8a4d9251528851abb1d17c57662c8c32dcb94a Mon Sep 17 00:00:00 2001 From: Season4 <872318548@qq.com> Date: Mon, 29 Jun 2015 12:13:01 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E7=BB=83=E4=B9=A03?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SRSDEMO/SRSDEMO.UI.Console/model/Professor.cs | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/SRSDEMO/SRSDEMO.UI.Console/model/Professor.cs b/SRSDEMO/SRSDEMO.UI.Console/model/Professor.cs index 2ca7c7c..76c97a6 100644 --- a/SRSDEMO/SRSDEMO.UI.Console/model/Professor.cs +++ b/SRSDEMO/SRSDEMO.UI.Console/model/Professor.cs @@ -106,10 +106,39 @@ public void DisplayTeachingAssignments() { //************************************** // - public void AgreeToTeach(Section s) { - Teaches.Add(s); - // We need to link this bidirectionally. - s.Instructor = this; +//ϰ3 + public void AgreeToTeach(Section s) + { + bool isSameTime = true; + + for (int i = 0; i < Teaches.Count; i++) + { + if (Teaches[i].OfferedIn == s.OfferedIn) + { + if (Teaches[i].DayOfWeek == s.DayOfWeek) + { + if (Teaches[i].TimeOfDay == s.TimeOfDay) + { + isSameTime = false; + } + else continue; + } + else continue; + } + else continue; + } + + if (isSameTime) + { + Teaches.Add(s); + // We need to link this bidirectionally. + s.Instructor = this; + } + else + { + Console.WriteLine("һλڲͬһͬһʱ̽ſΣ"); + } + } } From b509d8901f9726b6698db00515af2ef8f0b33693 Mon Sep 17 00:00:00 2001 From: Season4 <872318548@qq.com> Date: Mon, 29 Jun 2015 12:24:01 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E7=BB=83=E4=B9=A06?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SRSDEMO/SRSDEMO.UI.Console/model/Section.cs | 503 +++++++++++--------- 1 file changed, 273 insertions(+), 230 deletions(-) diff --git a/SRSDEMO/SRSDEMO.UI.Console/model/Section.cs b/SRSDEMO/SRSDEMO.UI.Console/model/Section.cs index 19dc9db..432a2e7 100644 --- a/SRSDEMO/SRSDEMO.UI.Console/model/Section.cs +++ b/SRSDEMO/SRSDEMO.UI.Console/model/Section.cs @@ -7,284 +7,327 @@ using System; using System.Collections.Generic; -public class Section { +public class Section +{ - //---------------- - // Constructor(s). - //---------------- + //---------------- + // Constructor(s). + //---------------- - public Section(int sNo, string day, string time, Course course, - string room, int capacity) { - SectionNumber = sNo; - DayOfWeek = day; - TimeOfDay = time; - RepresentedCourse = course; - Room = room; - SeatingCapacity = capacity; + public Section(int sNo, string day, string time, Course course, + string room, int capacity) + { + SectionNumber = sNo; + DayOfWeek = day; + TimeOfDay = time; + RepresentedCourse = course; + Room = room; + SeatingCapacity = capacity; - // A Professor has not yet been identified. + // A Professor has not yet been identified. - Instructor = null; + Instructor = null; - // Create empty Dictionary objects. + // Create empty Dictionary objects. - EnrolledStudents = new Dictionary(); - AssignedGrades = new Dictionary(); - } - - //------------------------------- - // Auto-implemented properties. - //------------------------------- - - public int SectionNumber { get; set; } - public string DayOfWeek { get; set; } - public string TimeOfDay { get; set; } - public Professor Instructor { get; set; } - public Course RepresentedCourse { get; set; } - public string Room { get; set; } - public int SeatingCapacity { get; set; } - public ScheduleOfClasses OfferedIn { get; set; } - - // The EnrolledStudents Dictionary stores Student object references, - // using each Student's ID as a String key. - - public Dictionary EnrolledStudents { get; set; } - - // The assignedGrades Dictionary stores TranscriptEntry object - // references, using a reference to the Student to whom it belongs - // as the key. - - public Dictionary AssignedGrades { get; set; } - - //----------------------------- - // Miscellaneous other methods. - //----------------------------- - - // For a Section, we want its String representation to look - // as follows: - // - // MATH101 - 1 - M - 8:00 AM - - public override string ToString() { - return RepresentedCourse.CourseNumber+" - "+ - SectionNumber+" - "+DayOfWeek+" - "+ - TimeOfDay; - } + EnrolledStudents = new Dictionary(); + AssignedGrades = new Dictionary(); + } - //*************************************************** - // - // The full section number is a concatenation of the - // course no. and section no., separated by a hyphen; - // e.g., "ART101 - 1". + //------------------------------- + // Auto-implemented properties. + //------------------------------- - public string GetFullSectionNumber() { - return RepresentedCourse.CourseNumber+ - " - "+SectionNumber; - } + public int SectionNumber { get; set; } + public string DayOfWeek { get; set; } + public string TimeOfDay { get; set; } + public Professor Instructor { get; set; } + public Course RepresentedCourse { get; set; } + public string Room { get; set; } + public int SeatingCapacity { get; set; } + public ScheduleOfClasses OfferedIn { get; set; } - //************************************** - // - public EnrollFlags Enroll(Student s) { - // First, make sure that this Student is not already - // enrolled for this Section, has not already enrolled - // in another section of this class and that he/she has - // NEVER taken and passed the course before. - - Transcript transcript = s.Transcript; - - if (s.IsEnrolledIn(this) || - s.IsCurrentlyEnrolledInSimilar(this) || - transcript.VerifyCompletion(RepresentedCourse)) { - return EnrollFlags.PREVIOUSLY_ENROLLED; - } + // The EnrolledStudents Dictionary stores Student object references, + // using each Student's ID as a String key. - // If there are any prerequisites for this course, - // check to ensure that the Student has completed them. + public Dictionary EnrolledStudents { get; set; } - Course c = RepresentedCourse; - if (c.HasPrerequisites()) { + // The assignedGrades Dictionary stores TranscriptEntry object + // references, using a reference to the Student to whom it belongs + // as the key. - foreach ( Course pre in c.Prerequisites ) { - - // See if the Student's Transcript reflects - // successful completion of the prerequisite. + public Dictionary AssignedGrades { get; set; } - if (!transcript.VerifyCompletion(pre)) { - return EnrollFlags.PREREQ_NOT_SATISFIED; - } - } + //----------------------------- + // Miscellaneous other methods. + //----------------------------- + + // For a Section, we want its String representation to look + // as follows: + // + // MATH101 - 1 - M - 8:00 AM + + public override string ToString() + { + return RepresentedCourse.CourseNumber + " - " + + SectionNumber + " - " + DayOfWeek + " - " + + TimeOfDay; } - - // If the total enrollment is already at the - // the capacity for this Section, we reject this - // enrollment request. - if (!ConfirmSeatAvailability()) { - return EnrollFlags.SECTION_FULL; + //*************************************************** + // + // The full section number is a concatenation of the + // course no. and section no., separated by a hyphen; + // e.g., "ART101 - 1". + + public string GetFullSectionNumber() + { + return RepresentedCourse.CourseNumber + + " - " + SectionNumber; } - - // If we made it to here in the code, we're ready to - // officially enroll the Student. - // Note bidirectionality: this Section holds - // onto the Student via the Dictionary, and then - // the Student is given an object reference to this Section. + //************************************** + // + public EnrollFlags Enroll(Student s) + { + // First, make sure that this Student is not already + // enrolled for this Section, has not already enrolled + // in another section of this class and that he/she has + // NEVER taken and passed the course before. + + Transcript transcript = s.Transcript; + + if (s.IsEnrolledIn(this) || + s.IsCurrentlyEnrolledInSimilar(this) || + transcript.VerifyCompletion(RepresentedCourse)) + { + return EnrollFlags.PREVIOUSLY_ENROLLED; + } - EnrolledStudents.Add(s.Id, s); - s.AddSection(this); - return EnrollFlags.SUCCESSFULLY_ENROLLED; - } - - //************************************** - // A private "housekeeping" method. - // - private bool ConfirmSeatAvailability() { - if ( EnrolledStudents.Count < SeatingCapacity ) { - return true; - } - else { - return false; + // If there are any prerequisites for this course, + // check to ensure that the Student has completed them. + + Course c = RepresentedCourse; + if (c.HasPrerequisites()) + { + + foreach (Course pre in c.Prerequisites) + { + + // See if the Student's Transcript reflects + // successful completion of the prerequisite. + + if (!transcript.VerifyCompletion(pre)) + { + return EnrollFlags.PREREQ_NOT_SATISFIED; + } + } + } + + // If the total enrollment is already at the + // the capacity for this Section, we reject this + // enrollment request. + + if (!ConfirmSeatAvailability()) + { + return EnrollFlags.SECTION_FULL; + } + + // If we made it to here in the code, we're ready to + // officially enroll the Student. + + // Note bidirectionality: this Section holds + // onto the Student via the Dictionary, and then + // the Student is given an object reference to this Section. + + EnrolledStudents.Add(s.Id, s); + s.AddSection(this); + return EnrollFlags.SUCCESSFULLY_ENROLLED; + } + + //************************************** + // A private "housekeeping" method. + // + private bool ConfirmSeatAvailability() + { + if (EnrolledStudents.Count < SeatingCapacity) + { + return true; + } + else + { + return false; + } } - } - //************************************** - // - public bool Drop(Student s) { - // We may only drop a student if he/she is enrolled. + //************************************** + // + public bool Drop(Student s) + { + // We may only drop a student if he/she is enrolled. - if (!s.IsEnrolledIn(this)) { - return false; - } - else { - // Find the student in our Dictionary, and remove it. + if (!s.IsEnrolledIn(this)) + { + return false; + } + else + { + // Find the student in our Dictionary, and remove it. - EnrolledStudents.Remove(s.Id); + EnrolledStudents.Remove(s.Id); - // Note bidirectionality. + // Note bidirectionality. - s.DropSection(this); - return true; + s.DropSection(this); + return true; + } } - } - //************************************** - // - public int GetTotalEnrollment() { - return EnrolledStudents.Count; - } - - //************************************** - // - public void Display() { - Console.WriteLine("Section Information:"); - Console.WriteLine("\tSemester: "+OfferedIn.Semester); - Console.WriteLine("\tCourse No.: "+ - RepresentedCourse.CourseNumber); - Console.WriteLine("\tSection No: "+SectionNumber); - Console.WriteLine("\tOffered: "+DayOfWeek + - " at "+TimeOfDay); - Console.WriteLine("\tIn Room: "+Room); - if ( Instructor != null ) { - Console.WriteLine("\tProfessor: "+Instructor.Name); + //************************************** + // + public int GetTotalEnrollment() + { + return EnrolledStudents.Count; } - DisplayStudentRoster(); - } - - //************************************** - // - public void DisplayStudentRoster() { - Console.Write("\tTotal of "+GetTotalEnrollment()+ - " students enrolled"); - - // How we punctuate the preceding message depends on - // how many students are enrolled (note that we used - // a Write() vs. WriteLine() call above). - - if ( GetTotalEnrollment() == 0 ) { - Console.WriteLine("."); - } - else { - Console.WriteLine(", as follows:"); + + //************************************** + // + public void Display() + { + Console.WriteLine("Section Information:"); + Console.WriteLine("\tSemester: " + OfferedIn.Semester); + Console.WriteLine("\tCourse No.: " + + RepresentedCourse.CourseNumber); + Console.WriteLine("\tSection No: " + SectionNumber); + Console.WriteLine("\tOffered: " + DayOfWeek + + " at " + TimeOfDay); + Console.WriteLine("\tIn Room: " + Room); + if (Instructor != null) + { + Console.WriteLine("\tProfessor: " + Instructor.Name); + } + DisplayStudentRoster(); } - // Use foreach loop to "walk through" the Dictionary. + //************************************** + // + public void DisplayStudentRoster() + { + Console.Write("\tTotal of " + GetTotalEnrollment() + + " students enrolled"); + + // How we punctuate the preceding message depends on + // how many students are enrolled (note that we used + // a Write() vs. WriteLine() call above). + + if (GetTotalEnrollment() == 0) + { + Console.WriteLine("."); + } + else + { + Console.WriteLine(", as follows:"); + } + + // Use foreach loop to "walk through" the Dictionary. - foreach ( KeyValuePair kv in EnrolledStudents ) { - Student s = kv.Value; - Console.WriteLine("\t\t"+s.Name); + foreach (KeyValuePair kv in EnrolledStudents) + { + Student s = kv.Value; + Console.WriteLine("\t\t" + s.Name); + } } - } - //********************************************************** - // This method returns the value null if the Student has not - // been assigned a grade. - // - public string GetGrade(Student s) { + //********************************************************** + // This method returns the value null if the Student has not + // been assigned a grade. + // + public string GetGrade(Student s) + { - string grade = null; + string grade = null; - // Only continue if the AssignedGrades Dictionary - // contains the Student as a key. + // Only continue if the AssignedGrades Dictionary + // contains the Student as a key. - if ( AssignedGrades.ContainsKey(s) == true ) { + if (AssignedGrades.ContainsKey(s) == true) + { - // Retrieve the Student's transcript entry object, if one - // exists, and in turn retrieve its assigned grade. - // If we found no TranscriptEntry for this Student, return - // a null value to signal this. + // Retrieve the Student's transcript entry object, if one + // exists, and in turn retrieve its assigned grade. + // If we found no TranscriptEntry for this Student, return + // a null value to signal this. + + TranscriptEntry te = AssignedGrades[s]; + if (te != null) + { + grade = te.Grade; + } + } - TranscriptEntry te = AssignedGrades[s]; - if (te != null) { - grade = te.Grade; - } + return grade; } - return grade; - } + //************************************************ + // + public bool PostGrade(Student s, string grade) + { + + // Make sure that we haven't previously assigned a + // grade to this Student by looking in the Dictionary + // for an entry using this Student as the key. If + // we discover that a grade has already been assigned, + // we return a value of false to indicate that + // we are at risk of overwriting an existing grade. + // (A different method, EraseGrade(), can then be written + // to allow a Professor to change his/her mind.) + + if (AssignedGrades.ContainsKey(s) == true) + { + return false; + } - //************************************************ - // - public bool PostGrade(Student s, string grade) { + // First, we create a new TranscriptEntry object. Note + // that we are passing in a reference to THIS Section, + // because we want the TranscriptEntry object, + // as an association class ..., to maintain object + // references on the Section as well as on the Student. + // (We'll let the TranscriptEntry constructor take care of + // "hooking" this T.E. to the correct Transcript.) - // Make sure that we haven't previously assigned a - // grade to this Student by looking in the Dictionary - // for an entry using this Student as the key. If - // we discover that a grade has already been assigned, - // we return a value of false to indicate that - // we are at risk of overwriting an existing grade. - // (A different method, EraseGrade(), can then be written - // to allow a Professor to change his/her mind.) + TranscriptEntry te = new TranscriptEntry(s, grade, this); - if ( AssignedGrades.ContainsKey(s) == true ) { - return false; - } + // Then, we add the TranscriptEntry and its associated + // Student to the AssignedGrades Dictionary. - // First, we create a new TranscriptEntry object. Note - // that we are passing in a reference to THIS Section, - // because we want the TranscriptEntry object, - // as an association class ..., to maintain object - // references on the Section as well as on the Student. - // (We'll let the TranscriptEntry constructor take care of - // "hooking" this T.E. to the correct Transcript.) + AssignedGrades.Add(s, te); - TranscriptEntry te = new TranscriptEntry(s, grade, this); + return true; + } - // Then, we add the TranscriptEntry and its associated - // Student to the AssignedGrades Dictionary. - AssignedGrades.Add(s, te); + //ϰ6 + public void EraseGrade(Student s, string grade) + { + if (AssignedGrades.ContainsKey(s) == true) + { + s.Transcript.TranscriptEntries.Remove(AssignedGrades[s]); + AssignedGrades.Remove(s); + TranscriptEntry te = new TranscriptEntry(s, grade, this); + AssignedGrades.Add(s, te); + } + } - return true; - } - - //************************************** - // - public bool IsSectionOf(Course c) { - if (c == RepresentedCourse) { + + //************************************** + // + + public bool IsSectioOf(Course c){ + if(c == RepresentedCourse){ return true; - } - else { + } + else{ return false; } } -} +} \ No newline at end of file From a2cf65a59fb130a6326471a9bff7fa38728eb05a Mon Sep 17 00:00:00 2001 From: Season4 <872318548@qq.com> Date: Mon, 29 Jun 2015 13:16:31 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SRSDEMO/SRSDEMO.UI.Console/model/Section.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SRSDEMO/SRSDEMO.UI.Console/model/Section.cs b/SRSDEMO/SRSDEMO.UI.Console/model/Section.cs index 432a2e7..6eb48a4 100644 --- a/SRSDEMO/SRSDEMO.UI.Console/model/Section.cs +++ b/SRSDEMO/SRSDEMO.UI.Console/model/Section.cs @@ -312,8 +312,11 @@ public void EraseGrade(Student s, string grade) if (AssignedGrades.ContainsKey(s) == true) { s.Transcript.TranscriptEntries.Remove(AssignedGrades[s]); + AssignedGrades.Remove(s); + TranscriptEntry te = new TranscriptEntry(s, grade, this); + AssignedGrades.Add(s, te); } } @@ -322,7 +325,7 @@ public void EraseGrade(Student s, string grade) //************************************** // - public bool IsSectioOf(Course c){ + public bool IsSectionOf(Course c){ if(c == RepresentedCourse){ return true; } From 1fc2d62deabd58e5fbac46806c7fd8964b2df0af Mon Sep 17 00:00:00 2001 From: Season4 <872318548@qq.com> Date: Mon, 29 Jun 2015 13:26:31 +0800 Subject: [PATCH 7/7] =?UTF-8?q?09123844=20=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SRSDEMO/SRSDEMO.UI.Console/SRS.cs | 2 +- SRSDEMO/SRSDEMO.UI.Console/model/Course.cs | 4 ++-- SRSDEMO/SRSDEMO.UI.Console/model/Professor.cs | 2 +- SRSDEMO/SRSDEMO.UI.Console/model/Section.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SRSDEMO/SRSDEMO.UI.Console/SRS.cs b/SRSDEMO/SRSDEMO.UI.Console/SRS.cs index a126c00..bc1c14e 100644 --- a/SRSDEMO/SRSDEMO.UI.Console/SRS.cs +++ b/SRSDEMO/SRSDEMO.UI.Console/SRS.cs @@ -286,7 +286,7 @@ static void Main(string[] args) Console.WriteLine(""); - //学生s3的课程c1第一学期的成绩是A,课程通过,s3可以选择课程c2 + //学生s3的课程c1第一学期的成绩是A。课程通过,s3可以选择课程c2 Console.WriteLine("Student " + s3.Name + " is attempting to enroll in " + diff --git a/SRSDEMO/SRSDEMO.UI.Console/model/Course.cs b/SRSDEMO/SRSDEMO.UI.Console/model/Course.cs index fcd7cc4..6a74b44 100644 --- a/SRSDEMO/SRSDEMO.UI.Console/model/Course.cs +++ b/SRSDEMO/SRSDEMO.UI.Console/model/Course.cs @@ -106,7 +106,7 @@ public Section ScheduleSection(string day, string time, string room, int capacity) { // Create a new Section (note the creative way in // which we are assigning a section number) ... - //ϰ4 Ϊ˱֤ѡκŶһ + //ϰ4 Ϊ˱֤ѡκŶһ sectionnum = sectionnum + 1; Section s = new Section(sectionnum, day, time, this, room, capacity); @@ -119,7 +119,7 @@ public Section ScheduleSection(string day, string time, string room, - //ϰ4 + //ϰ4 public void CancelSection(Section s) { //γ̴ѡƳ diff --git a/SRSDEMO/SRSDEMO.UI.Console/model/Professor.cs b/SRSDEMO/SRSDEMO.UI.Console/model/Professor.cs index 76c97a6..c852f1f 100644 --- a/SRSDEMO/SRSDEMO.UI.Console/model/Professor.cs +++ b/SRSDEMO/SRSDEMO.UI.Console/model/Professor.cs @@ -107,7 +107,7 @@ public void DisplayTeachingAssignments() { //************************************** // -//ϰ3 +//ϰ3 public void AgreeToTeach(Section s) { bool isSameTime = true; diff --git a/SRSDEMO/SRSDEMO.UI.Console/model/Section.cs b/SRSDEMO/SRSDEMO.UI.Console/model/Section.cs index 6eb48a4..c473bfc 100644 --- a/SRSDEMO/SRSDEMO.UI.Console/model/Section.cs +++ b/SRSDEMO/SRSDEMO.UI.Console/model/Section.cs @@ -306,7 +306,7 @@ public bool PostGrade(Student s, string grade) } - //ϰ6 + //ϰ6 public void EraseGrade(Student s, string grade) { if (AssignedGrades.ContainsKey(s) == true)