Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please help me finish this code! please follow the instructions 7.5 Lab 46: Driver's License Exam The local Driver's License Office has asked you to
please help me finish this code! please follow the instructions
7.5 Lab 46: Driver's License Exam The local Driver's License Office has asked you to write a program that grades the written portion of the driver's license exam. The exam has 10 multiple choice questions. The correct answers are as follows: 1. A 2.D 3. B 4 B 5.G 6. B 8. B 10.D Your program should store the correct answers shown above in an array named correctAnswer[]. It should then read in the user's answers for the 10 questions and validate the input. An answer can only be an A, B, C or D. The validated answers should be stored in another array named userAnswer[]. After the user'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 7 of the 10 questions to pass the exam. The program should then display the total number of correctly answered questions and the total number of incorrectly answered questions. Hint: You will need parallel arrays to solve this problem. Check slides 8 thru 10 of C81336_Lect7c_Arrays_Compare_Parallel.pptx, and Pr7-15.cpp for examples. Input Validation: Only accept the characters A, B, C, or D as answers. Hint, while (userAnswer[i] 'D') Use constants to define your number of questions and the passing score; const int Size = 10, PASSING = 7; When the program's input is as shown in Figure 1 your program should broduce the output as shown in Figure 2 Figure 1: (input) A B B B B C 2 Figure 2: (output) You passed the exam. Congratulations Number of correct answers: 9 Number of incorrect answers: 1 When the program's input is as shown in Figure 3 your program should produce the output as shown in Figure 4. Figure 3: (input) b 4 BA B A C D A DCC Figure 4: (output) You did not pass the exam. You may try again. Number of correct answers: 4 Number of incorrect answers: 6 string studentName[] = ("Amanda Baynes", "Victor Hughes", "Scott Collins", "Lori Macbeth", "Manny Lopez"); [0] [1] [2] [3] [4] Amanda Baynes": "Victor Hughes" "Scott Collins" "Lori Macbeth" "Manny Lopez" Sample studentGrade array declaration and example of how it appears in memory const int NUM STUDENTS = 5, NUM GRADES = 3; int studentGrade [NUM STUDENTS) (NUM GRADES); V/Get the grades from the user for (int i = 0; i > studentGrade[i][jl; 1 Column [i][0] Column 1 [i][1] Column 2 [i][2] Row 0 [0][j] 89 90 95 Row 1 [1][j] 67 78 BO Row 2 [216] 100 91 98 Row 3 [3] [1] 75 70 78 Row 4 1416) 78 BO 85
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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