Problem

Driver’s License Exam The State Department of Motor Vehicles (DMV) has asked you...

Driver’s License Exam

The State Department of Motor Vehicles (DMV) has asked you to write a program that grades the written portion of the driver’s license exam, which has 20 multiple choice questions. Here are the correct answers:

To do this you should create a TestGrader class. The class will have an answers array of 20 characters, which holds the correct test answers. It will have two public member functions that enable user programs to interact with the class: setKey and grade. The setKey function receives a 20-character string holding the correct answers and copies this information into its answers array. The grade function receives a 20-character array holding the test taker’s answers and compares each of their answers to the correct one. An applicant must correctly answer 15 or more of the 20 questions to pass the exam. After “grading” the exam, the grade function should create and return to the user a string that includes the following information:

a message indicating whether the applicant passed or failed the exam

the number of right answers and the number of wrong answers

a list of the question numbers for all incorrectly answered questions. The client program that creates and uses a TestGrader object should first make a single call to setKey, passing it a string containing the 20 correct answers. Once this is done it should allow a test taker’s 20 answers to be entered, making sure only answers of A–D are accepted, and store them in a 20-character array. Then it should call the grade function to grade the exam and should display the string the function returns. The program should loop to allow additional tests to be entered and graded until the user indicates a desire to quit.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT