Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

can you help me with this, please? 1. Using Arrays: Driver’s License Exam Grader

ID: 3702052 • Letter: C

Question

can you help me with this, please?


1. Using Arrays: Driver’s License Exam Grader System

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. Here, are the correct answers:

1.B 6. A 2.D 7. B 3.A 8. A 4.A 9. C 5.C 10. D

Your program should store the correct answers shown above in a character array named “correctAnswers” (In this assignment you are not doing any string manipulation, so the “Answer” array can be a simple character array, not a string).

Then, it should ask the user to enter the student’s answers for each of the 10 questions, and the answers should be stored in another array named “studentAnswers”.

In order to pass the exam a student must answer at least 8 questions out of 10. So, the “grade” function checks the entries in both array and determine if the student has answered at least 8 questions correctly.

If student has passed the exam, your program should display the following message

Congratulations!

You have passed exam.
Total number of correct answers: < > Total number of incorrect answers: < >

If student has failed the exam, your program should display the following message

Sorry, you have not passed the exam! Total number of correct answers: < > Total number of incorrect answers: < >

Input validation: Only accept the letters A, B, C, or D as answers. If user enters any other letter, your program should display a message indicating A, B, C, and D are the only valid inputs. If user enters invalid input more than three times display the message

“ GOOD BYE “ and exit the program.

Explanation / Answer

Code -

#include<bits/stdc++.h>

using namespace std;

int main()

{

string ans;

cin>>ans;

char ar[10];

for(int i=0;i<ans.length();i++)

{

if(isdigit(ans[i]-'0'))

ar[s[i]-'0']=ans[i+2];

}

char st[10];

string student;

cin>>student;

for(int i=0;i<student.length();i++)

{

if(isdigit(student[i]-'0'))

st[student[i]-'0']=student[i+2];

}

int count =0;

for(int i=0;i<10;i++)

if(ar[i]==st[i])

count++;

if(count>7)

cout<<"Congratulations!"<<endl<<"You have passed exam."<<endl<<"Total number of correct answers:"<<count <<" Total number of incorrect answers:" <<10-count<<endl;

else

cout<<"Sorry, you have not passed the exam! Total number of correct answers:"<<count <<" Total number of incorrect answers:" <<10-count<<endl;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote