The State Department of Motor Vehicles (DMV) has asked you to write a program that grades...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
The file OIL.GDP.xls contains annual time series data for country Z in Africa. The variables in this data set are: Inflation ( INFL ) measured as a percentage, oil price ( OILP ) measured in dollars...
-
One molecule is observed for 20 seconds, and follows From the above set of data, estimate the probability that a molecule that is inside a cell leaves during a given second, and the probability that...
-
Table B.4 presents data for 27 houses sold in Erie, Pennsylvania. a. Fit a simple linear regression model relating selling price of the house to the current taxes ( x1 ). b. Test for signifi cance of...
-
Lowell Inc. projects unit sales for a new project with a life of FOUR YEARS as follows: year 1 = Unit sales 10,000 Year 2 = Unit sales 12,000 Year 3 = Unit sales 14,000 Year 4 = Unit sales 16,000...
-
Generally, what is the time schedule for payment of workers compensation insurance premiums?
-
Suppose the government reduces taxes by 2 billion, that there is no crowding out and that the MPC is 0.75. a. What is the initial effect of the tax reduction on AD? b. What additional effects follow...
-
Find five interesting facts in Table 1.1. TABLE 1.1 Basic Characteristics of Selected Countries GNP per capita Index of Openness Goods & Services 2009 Population Area (millions) (1,000s sq. km.) Avg....
-
Consider the following situations: a. Business receives $3,800 on January 1 for 10-month service contract for the period January 1 through October 31. b. Total salaries for all employees is $3,200...
-
Two resistors are connected in parallel with an 99 volt battery. The resistors have values of R 1 = 7 ohms and R 2 = 55 ohms. What is the current (in amps) in this circuit? Round your answer to two...
-
Antelopes, native to Africa and Asia, range in size from 30 cm to over 180 cm at the shoulder, with most between 90-120 cm. This is related to the humerus length. The data below gives the length and...
-
Executives posted overseas often have difficulty in effectively managing local staff that may be from another culture. Discuss the main benefits and limitations of using one of the cultural models...
-
Is wavelike motion an example of conservative or diffusive motion?
-
Using the interconnection between sectors of the economy, illustrate the effects of imposing an increase in taxes on the household sector.
-
A copper rod, \(15 \mathrm{~mm}\) in diameter, is attached to a wall that is at a temperature of \(200^{\circ} \mathrm{C}\). The opposite end of the rod is insulated. The rod is \(100 \mathrm{~mm}\)...
-
The catalyst effectiveness is the analog of what derived property of a fin?
-
What is the change of the speed of sound with frequency called?
-
How do you see the effects of technology on us as human beings [adults and children]?
-
Rewrite the code of Figure 7.3 in Ada, Java, or C#. Figure 7.3: template class queue { item items [max_items]; int next_free, next_full, num_items; public: queue () : next_free (0), next_full(0),...
-
The headquarters of Hill Cist Corporation, a private company with $15.5 million in annual sales, is located in California. Hill Crest provides for its 150 clients an online legal software service...
-
Discuss the concept of exposure and explain why firms may tolerate some exposure.
-
What is meant by inheritance? Give an example.
-
What factors is a judge likely to consider when determining best interest?
-
What is the best interest standard?
-
What criticisms are commonly made about the best interest standard?
Study smarter with the SolutionInn App