Project 5 Driver’s License

Objectives

• using parallel arrays, standard functions, reference parameters and value parameters to solve a problem.

• designing and describing algorithms using structure chart.

 

Problems

The local Driver’s License Office has asked you to write a program that grades the written portion of the driver’s exam. The exam has 20 multiple choice questions. A data file contains the correct answers as follows:

B D A A C A B A C D B C D A D C C B D A

Your program should read above correct answers from the file to an array. It should ask the user to enter the student’s answers for each of the 20 questions, and the answers should be stored in another array. After the student’s answers have been entered, the program should display a message indicating whether the student passed or failed the exam. (A student must correctly answer 15 of the 20 questions to pass the exam.) It should then display the total number of correctly answered questions, the total number of incorrectly answered questions, and a list of showing the question numbers of the incorrectly answered questions.

 

Input Validation: only accept the letters of A, B, C or D as answers.

 

Input

• Answers of 20 questions

Output

• A message to indicate if the student has passed the exam.

• Number of correct answers.

• Number of incorrect answers.

• A list that shows the question numbers of the incorrectly answered questions

 

An Example of Test Run

The output of your program might look like this

 

>a.out

Please enter the student's answers for each of the questions. Press Enter after typing each answer.

Please enter only an A, B, C, or D for each question. Question 1: B

Question 2: D

Question 3: A

Question 4: A

Question 5: A

Question 6: B

Question 7: B

Question 8: A

Question 9: C

Question 10: D

Question 11: B

Question 12: B

Question 13: D

Question 14: A

Question 15: D

Question 16: D

Question 17: A

Question 18: B

Question 19: D

Question 20: A

 

Student passed the exam

 

Correct Answers = 15 Incorrect Answers = 5

 

The list below shows the question numbers of the incorrectly answered questions

5

6

12

16

17

 

Need a custom answer at your budget?

This assignment has been answered 3 times in private sessions.

© 2021 Codify Tutor. All rights reserved