Page 1 of 1

For this question, you are required to write code. You may write the code directly in the provided textbox or create it

Posted: Sat May 14, 2022 3:44 pm
by answerhappygod
For This Question You Are Required To Write Code You May Write The Code Directly In The Provided Textbox Or Create It 1
For This Question You Are Required To Write Code You May Write The Code Directly In The Provided Textbox Or Create It 1 (109.32 KiB) Viewed 51 times
For This Question You Are Required To Write Code You May Write The Code Directly In The Provided Textbox Or Create It 2
For This Question You Are Required To Write Code You May Write The Code Directly In The Provided Textbox Or Create It 2 (67.31 KiB) Viewed 51 times
For this question, you are required to write code. You may write the code directly in the provided textbox or create it in an IDE (or even Notepad) first and then paste it in the textbox. Only text is allowed in the textbox, i.e. no screenshots of code may be posted. You start the question with full marks and then marks are deducted for any errors or omissions. Your answer should consist of the code for a class called MarksManager and the Main method of a program, to demonstrate how Marksmanager may be used. The class and Main method will be marked independently, meaning that you cannot lose all of your marks for making too many mistakes in one of the steps. The university makes use of a centralised system for the capture and calculation of exam marks. The system is based on the concept of the singleton design pattern. The singleton class used in this system is called MarksManager. The MarksManager hides all of its fields and/or properties, clients of the class have to make use of public methods. The system in which the MarksManager will be used employs threading, The Marks Manager may be set to be either in Calculation mode or not. The Marks Manager has a method, Calculation Mode which receives a Boolean variable to set the Marks Manager to Calculation mode (true) or not (false). When not in Calculation mode, the MarksManager allows for marks to be captured using objects of type ExamMark, by means of a public method CaptureMark, which receives Exam Mark objects. The mark should only be added if the MarksManager is not in CalculationMode. The code for class ExamMark is shown below. class Exam Mark 1 public string Student Number I get private set: publie string SubjectCode: get: private set:: publie double Percentage get private set: public Exam Mark(string Student Number, string SubjectCode, double Percentage) this. Student Number Student Number: this.SubjectCode SubjectCode: this. Percentage Percentage:

objects onype Exammalk, by means ora public method CaptureMark, which receives Exam Mark objects. The mark should only be added if the Time left 0:32 not in Calculation Mode. The code for class Exam Mark is shown below. class Exam Mark { public string Student Number get; private set; } public string SubjectCode get; private set: to public double Percentage { get; private set; } public Exam Mark(string Student Number, string SubjectCode, double Percentage) { this. Student Number=Student Number, this. SubjectCode = SubjectCode: this.Percentage = Percentage; 3 The Marksmanager must keep track of a centralised list of Exam Marks: The Marksmanager must provide a public method, CalculateStudent, by which a student number may be passed to the Marksmanager and it will calculate an average exam mark for the student number from the saved list of student numbers. The CalculateStudent method must only performa calculation when the Marks Manager is set to Calculation mode; otherwise it should return a value of -1.