Use your completed Grade Book 2.5 as the starting project. Keep the lists, fixed attempt history, weekly schedule, and existing feedback while moving required setup into constructors.
Update the window title in MainWindow.xaml to identify Grade Book 2.6 and your last name. In Properties/AssemblyInfo.cs, update both assembly version values to 2.6.0.0. Keep the existing .NET Framework 4.8 project configuration.
Place this declaration inside the Attempt class, outside its existing methods. The UML + means public; C# places each parameter's type before its name. A constructor has no void or other return type. This first example shows the declaration and assignment pattern; use the focused diagrams for the remaining constructors.
public Attempt(string studentName, string completionDate, double accuracy)
{
this.StudentName = studentName;
this.CompletionDate = completionDate;
this.Accuracy = accuracy;
}Use the constructor's parameters to initialize the matching fields. Make Accuracy, CompletionDate, and StudentName readonly. Keep Score writable because grading assigns it after an ordinary submission is created.
Move the score calculation from Instructor.Grade into this new method. Here this refers to the Attempt being graded, so read its own accuracy and assign its own score. Keep the input checks shown in the diagram and keep the unrounded result.
Initialize the same evidence fields as the three-parameter constructor, then call Grade with possiblePoints. The compiler chooses the matching constructor declaration from the supplied arguments; neither constructor contains an argument-count if statement. This overload will initialize certification exams. The ordinary submission path continues to use the three-parameter constructor and receives its score through the grading workflow.
Use the parameters to initialize Name, Type, Points, and Difficulty, and make those fields readonly. Move the attempts array instantiation from its field initializer into this constructor. Each Assignment still gets its own array of three Attempt references.
| Parameter | Field |
|---|---|
| name | Name |
| type | Type |
| possiblePoints | Points |
| difficulty | Difficulty |
Store the calculated percentage in a local accuracy variable, including the existing full-knowledge condition. Move the line that instantiates submission below that calculation. Use the Attempt constructor to assign the student's name, completion date, and accuracy; remove the old assignments to the attempt's now-readonly fields.
The Assignment knows its available points. For a non-null Attempt, call that object's Grade method and pass this.Points.
Retain the existing null checks, accuracy and points checks, and Boolean return. Call assignment.Grade(attempt) where the instructor previously calculated the score. Keep the passing threshold at 70 percent.
This is a source trace until the creation handlers are updated. Follow the sequence without running the incomplete project: Instructor.Grade chooses the passing result, Assignment.Grade supplies its points, and Attempt.Grade writes its score. The existing Submit method still stores unsuccessful attempts in history and only updates submission for a passing attempt that is better than the previous passing submission.
Initialize Name, Salary, and KnowledgeLevel from the matching parameters and make those fields readonly. Move the private assistants list instantiation into the constructor. Keep CertificationExam writable and keep numberOfStudentsTutored as the mutable private count.
Initialize Number, Name, Fee, and Teacher from the parameters and make those fields readonly. Move the private assignments list instantiation into the constructor. For the debugger trace below, assign Number, Name, Fee, and Teacher in that order, then instantiate assignments last. Keep GetTutor public: existing tutoring handlers still call it to display the selected tutor's details.
Initialize Name, Id, KnowledgeLevel, and Course. Make only Name, Id, and Course readonly; tutoring and assignment completion still change knowledge. Keep RequiredSessions and IsOnProbation as ordinary writable fields for this version.
Move new Student[3, 5] from the sessions field initializer into this constructor. Keep the field private and readonly. This is a new empty grid of Student references, with three period rows and five weekday columns; it does not create fifteen students.
Initialize Url, Version, CurrentStudent, and PrimaryInstructor from the matching parameters. Create Schedule with a new TutoringSchedule inside the constructor. Make all five fields readonly. The student and instructor references are supplied objects, while the schedule is a new contained object created for this GradeBook.
Create the instructor before its course, the course before its student, and the GradeBook after those objects exist. The Course teacher and GradeBook primary instructor must reference the same Instructor instance.
Ensure no old parameterless business-object creation remains except new TutoringSchedule(), whose explicit parameterless constructor is required. Ensure no caller assigns a readonly field after construction. Retain the existing public-field suppression attributes while this version still uses public fields.
Start debugging and click New Canvas. When execution pauses in MainWindow, open Watch 1 and add the expressions below. They are unavailable before the Course constructor's frame is active. Disable the MainWindow breakpoint before continuing.
| Expression | Before its frame is active | At the breakpoint |
|---|---|---|
| number | Unavailable | "101" |
| name | Unavailable | "English Comp" |
| fee | Unavailable | 400.00 |
| teacher.Name | Unavailable | "Jeff" |
| this.Teacher | Unavailable in this constructor's frame | null |
| this.assignments | Unavailable in this constructor's frame | null |
At the breakpoint, this is the new Course, not MainWindow. The teacher parameter already references Jeff, but the highlighted this.Number = number statement has not executed yet. An unavailable expression has no accessible variable or member in the current frame; it is different from a field whose current value is null.
Observe the parameters becoming field values. After this.Teacher = teacher executes, this.Teacher and teacher refer to Jeff. While this.assignments = new List<Assignment>() is highlighted, the field is still null. Press F10 to execute that statement, then expand the field in Watch and confirm its Count is 0.
The existing handler adds the Plan, Midterm, and Final assignments after course construction. Confirm Canvas created. appears and the schedule has fifteen available cells. Stop debugging before the next check.
Start debugging, click New Blackboard, then Take final. At the handler breakpoint, open Watch 1 and add these expressions before entering Assignment.Complete. Disable the handler breakpoint, leaving the submission breakpoint enabled.
| Expression | At the submission-instantiation breakpoint | After F10 executes that statement |
|---|---|---|
| difficultyFactor | 67.6 | 67.6 |
| accuracy | 66.55 | 66.55 |
| submission | Not assigned by this statement yet; Watch may show null, an uninitialized value, or an unavailable expression | A new Attempt |
| submission.StudentName | No usable Attempt reference yet; unavailable or cannot evaluate through null | "Arthur" |
| submission.CompletionDate | No usable Attempt reference yet; unavailable or cannot evaluate through null | "12/18/2018" |
| submission.Accuracy | No usable Attempt reference yet; unavailable or cannot evaluate through null | 66.55 |
| submission.Score | No usable Attempt reference yet; unavailable or cannot evaluate through null | 0 |
The highlighted instantiation has not executed. Press F10 once to create the Attempt with three arguments. Its score is still zero because the constructor stores evidence without grading it.
The final attempt receives an unrounded score of 66.55 and grade F. It is retained in history even though it is not a passing submission. Its displayed history accuracy uses the existing two-decimal format. The average for this one attempt is 66.55 percent. Stop debugging.
The first three clicks create attempts at 79.58%, 82.08%, and 84.58% displayed accuracy, with grades C, B, and B. Best accuracy is 84.58% and average accuracy is 82.08%. The fourth reports that no further attempt is available, creates no attempt, and adds no knowledge; Arthur remains at knowledge 80.5. The Plan and Final each have their own separate three-slot history.
Samantha starts at knowledge 87.8 with four sessions required. She completes two sessions with Jeff, reaches knowledge 95, and still requires two sessions. The feedback reports that no tutor has a higher knowledge level and includes the tutor and student details. Pressing Complete Samantha tutoring again completes zero sessions and preserves those values.
The reservation clears only after successful tutoring, the displayed count becomes 0, and Samantha now has knowledge 92.8 with three sessions required. Tutor details remain in the attendance feedback. The attempt history stays array-backed and the schedule remains a rectangular array.
Green squares mark new members; blue squares mark changes to existing members. Other fields and methods remain in the project even where the diagrams abbreviate them.
Submit the resulting Feedback System URL to the Grade Book 2.6 assignment in Canvas.