Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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,
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 ques- tions. Here are the correct answers: 1. B 2. D 3. A 4. A 5. C 6. A 7. B 8. A 9. C 10. D 11. B 12. C 13. D 14. A 15. D 16. C 17. C 18. B 19. D 20. A 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. After "grading" the exam, the function should display a message indicating whether the applicant passed or failed the exam. An applicant must correctly answer 15 or more of the 20 questions to pass the exam. The function should then display the total number of correctly answered questions, the total number of incorrectly answered questions, and 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, store them in a 20-character array, and then call the grade function to grade the exam. The program should loop to allow additional tests to be entered and graded until the user indicates a desire to quit. Input Validation: Only accept the letters A,B,C, and D for the test answers.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
include include using namespace std class Tes...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