Answered step by step
Verified Expert Solution
Question
1 Approved Answer
We Would like to implement a system that helps instructors to manage exams for a specific course. The system offers a number of functionalities such
We Would like to implement a system that helps instructors to manage exams for a specific course. The system offers a number of functionalities such as: add exam questions, print exams, take an exam and so on Each course has three exams: midterm # midterm # and the final. Each exam has two kinds of questions: TrueFalse Questions and Multiple Choice Questions. The first step we would like to do is to define two classes: TrueFalse class and MultipleChoice class.The UML for class TrueFalse is: TrueFalse score: float text: string correctAnswer: char studentAnswer: char TrueFalse readQuestion: void void printQuestion:void void setStudentAnswerchar answer: void float getScore: float char getStudentAnswer: char char getCorrectAnswer: char The UML for class MultipleChoice is: MultipleChoice score: float text: string choices: string correctAnswer: char studentAnswer: char MultipleChoice readQuestion: void void printQuestion:void void setStudentAnswerchar answer: void float getScore: float char getStudentAnswer: char char getCorrectAnswer: char Attributes score: To represent the score of the question. text: To represent question text. correctAnswer: To represent correct answer of the question. studentAnswer: To represent student answer of the question.For class MultipleChoice choices: To represent the four choices of the question. ConstructorDefault constructor initialize attributes.Class TrueFalse Functions readQuestion:itreadsfromuserquestiontext,correctanswer,whichiseitherTorFandscoreofthe question. printQuestion: It prints the question in the format:QuestionText QuestionScore point setters getters Class MultipleChoice Functions readQuestion:itreadsfromuserquestiontext,fourchoices,correctanswer,whichiseitherA,BC or D and score of the question. printQuestion: It prints the question in the format: QuestionText:A firstChoiceB. secondChoiceC thirdChoiceD. fourthChoice QuestionScore point setters getters The next step is to define the class Exam. Each exam has exactly two TrueFalse Questions andtwo Multiple Choice Questions: Exam type: string information: string TFQ: TrueFalse MCQ: MultipleChoice totalScore: float studentScore: float Exam addQuestionsstring t: void printExam:void calculateTotalScore:void takeExam:void correctExam:void getFormattedInfo: string getType:string getStudentScore: float Attributes type: To represent the type of the exam. information: To represent exam information including instructor name, date and time. TFQ: To represent two TrueFalse Questions. MCQ: To represent two Multiple Choice Questions. totalScore: To represent the total score of the exam. studentScore: to represent student score in the exam.ConstructorsDefault constructor to initialize attributes.Functions addQuestion: It initializes exam attributes. It accepts exam type which is either midterm #midterm # or final. It then asks the user to enter exam information in the format: instructorName ExamDate ExamTime, two TrueFalse Questions and two Multiple Choice Questions. It also calculates the total score. Please note that the student score will not be initialized here. printExam: It prints the exam as shown in the sample run. It prints the type of the exam, exam information, TrueFalse Questions, Multiple Choice Questions, and exams total score. Please note that exam information is printed in the following format: calculateTotalScore:ItcalculatesandassignsexamstotalscorebasedonTrueFalseQuestions scores and Multiple Choice Questions score. takeExam: It first displays the type of the exam and formatted exam information see function getFormattedInfo below It also displays each question and asks the user to enter the correct answer, which is either T or F for TrueFalse Questions and A B C or D for Multiple Choice Questions. It then initializes student answer for each question. correctExam: It corrects the exam. It first displays the type of the exam and formatted exam information. For each question, it displays the student answer, the correct answer and the student score in the format:Score studentQuestionScore questionScoreIt then calculate and displays the student score in the exam in the format:Total Score studentScore totalScore getFormattedInfo: it converts exam information from the format:instructorName ExamDate ExamTimeto the format:It then returns the formatted exam information Getters Instructor: instructorName Date: examDateTime: examTime Instructor: instructorName Date: examDateTime: examTime Now we reach the final step, which is testing your system in the main function. Before that, we need declare a global array of size to store all exams. In the main function, a list will be repeatedly displayed to the user with the following options: Add exam questions. Print a specific exam. Print all three exams. Take an exam Correct an exam. EXIT. Ask the user to enter the type of the exam to be added, which could be either midterm # midterm # or final. The exam will be added in the corresponding location in the exam array, ie midterm # in the first position, midterm # in the second position and the final in the third position. Please note that the user will not be allowed to add an exam if it has been added already and an appropriate message will be printed accordingly. AsktheusertoenterthetypeoftheexamtobeprintedThen,printtheexamifithasbeenaddedalready or print an appropriate message otherwise. PrintallthreeexamsPrintthemessageExamisnotapplicable iftheexamhavenotbeenadded. Ask the user to enter the type of the exam to be taken. Then, take the exam if it has been added already or print an appropriate message otherwise. Please note that an exam can be taken several times. Ask the user to enter the type of the exam to be corrected then correct the exam. The exam will not be corrected if it either has not been added already or added but has not been taken. Exit the system.Note: There are three types of exams: midterm # midterm # and final. Suppose that the user will always enter valid data, so no need to validate user entry.In the attached file, some system functions that could help you in the main are implemented for you. These functions are: getExam:itacceptsthetypeoftheexamandreturnsthecorrespondingindexfortheexam,where midterm # is stored in the first position, midterm# in the second position and the final in the third position. exists: it accepts the type of the exam and returns true if it exists added and false otherwise.
Write code in C
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started