Answered step by step
Verified Expert Solution
Link Copied!

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 #1, midterm #2 and the final. Each exam has two kinds of questions: True/False 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 setStudentAnswer(char 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 setStudentAnswer(char 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,B,C 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 True/False Questions andtwo Multiple Choice Questions: Exam - type: string- information: string- TFQ: TrueFalse[]- MCQ: MultipleChoice[]- totalScore: float- studentScore: float Exam() addQuestions(string 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 True/False 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 #1,midterm #2 or final. It then asks the user to enter exam information in the format: instructorName ExamDate ExamTime, two True/False 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, True/False Questions, Multiple Choice Questions, and exams total score. Please note that exam information is printed in the following format: calculateTotalScore:ItcalculatesandassignsexamstotalscorebasedonTrue/FalseQuestions 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 True/False 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 3 to store all exams. In the main function, a list will be repeatedly displayed to the user with the following options:1. Add exam questions. 2. Print a specific exam. 3. Print all three exams. 4. Take an exam.5. Correct an exam. 6. EXIT.(1) Ask the user to enter the type of the exam to be added, which could be either midterm #1, midterm #2 or final. The exam will be added in the corresponding location in the exam array, i.e. midterm #1 in the first position, midterm #2 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. (2)Asktheusertoenterthetypeoftheexamtobeprinted.Then,printtheexamifithasbeenaddedalready or print an appropriate message otherwise. (3)Printallthreeexams.PrintthemessageExamisnotapplicable iftheexamhavenotbeenadded. (4) 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.(5) 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.(6) Exit the system.Note: There are three types of exams: midterm #1, midterm #2, 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 #1 is stored in the first position, midterm#2 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Genomes And Databases On The Internet A Practical Guide To Functions And Applications

Authors: Paul Rangel

1st Edition

189848631X, 978-1898486312

More Books

Students also viewed these Databases questions

Question

Analyze the impact of labor unions on health care.

Answered: 1 week ago

Question

Assess three motivational theories as they apply to health care.

Answered: 1 week ago

Question

Discuss the history of U.S. labor unions.

Answered: 1 week ago