The local driver’s license office has asked you to write a program that grades the written portion of the driver’s license Rules and Signals Test. The driver license test has 25 multiple choice questions. The set of answer keys is:
1.A 6.B 11.C 16.B 2 21.B
2.C 7.C 12.A 17.A 22.C
3.B 8.D 13.B 18.C 23.A
4.B 9.A 14.C 19.A 24.D
5.D 10.B 15.A 20.D 25.B
First, the application displays messages to ask for the information of current candidate about last name, first name, SS number to create a Test account When the canidate is ready, display the test instruction, questions and read answers
DRIVER LICENSE TEST
THERE ARE 25 MULTIPLE CHOICE QUESTIONS
YOU HAVE TO GET 20 CORRECT ANSWERS TO GET PASSED
------------------------------------------------
Question 1: _ The users answer the question by typing a letter A, B, C or D for each question. If users type other keys than A, B, C or D; display message “Invalid key – Retype” and allow users to retype the answer of current question before moving on
All the answers and the key set should be sent to the Test account in array type to evaluate the result.
The result will be displayed on the screen in the following format, where the date is current date and Driver’s license number is a combination of two random 4-digit numbers
DRIVER LICENSE TEST RESULT
Driver’s name: Smith, James
SS Number: 112233440
Phone Number: 2141234567
Address: 123 Plano Rd Dallas TX 75243
Driver’s License: 12345678
Test date: 03/15/2018
Result: PASSED
Missed Questions: 5, 12, 15
The program will be available for other candidates to test until users choose to exit
This program is in java
Note: Could you plz go this code and let me know if
u need any changes in this.Thank You
_________________
DriveExam.java
class DriveExam {
// an array of student's answers.
private final String[] correctAnswers = { "B", "D", "A", "A", "C", "A",
"B", "A", "C", "D", "B", "C", "D", "A", "D", "C", "C", "B", "D",
"A" };
// Store the User answers
private final String[] userAnswers;
int[] missed = new int[correctAnswers.length];
// Process the user answers
public DriveExam(String[] Answers) {
userAnswers = new String[Answers.length];
for (int i = 0; i < Answers.length; i++) {
userAnswers[i] = Answers[i];
}
}
// return boolean value if correct answers > 15
public boolean passed() {
if (totalCorrect() >= 15)
return true;
else
return false;
}
// total Correct answers
public int totalCorrect() {
int correctCount = 0;
for (int i = 0; i < correctAnswers.length; i++) {
if (userAnswers[i].equalsIgnoreCase(correctAnswers[i])) {
// missed [correctCount]= i;
correctCount++;
}
}
return correctCount;
}
// total Correct answers
public int totalInCorrect() {
int incorrectCount = 0;
for (int i = 0; i < correctAnswers.length; i++) {
if (!userAnswers[i].equalsIgnoreCase(correctAnswers[i])) {
missed[incorrectCount] = i;
incorrectCount++;
}
}
return incorrectCount;
}
// Missed questions.
public int[] questionMissed() {
return missed;
}
public void displayUserAnswers()
{
System.out.println("Student Answers :");
for(int i=0;i<userAnswers.length;i++)
{
System.out.print(userAnswers[i]+" ");
}
System.out.println();
}
}
___________________________
ExamApplication.java
import java.util.Scanner;
public class ExamApplication
{
public static void main(String[]args)
{
System.out.println("Driver's Lincense Exam");
//scanner class object is used to read the inputs entered by the
user
Scanner kb=new Scanner(System.in);
System.out.println("20 Multiple choice questions ");
// Creating the array of type String
String [] answers = new String [20];
String answer;
for (int i =0; i <20;i++)
{
do
{
System.out.print((i+1)+":");
answer = kb.nextLine();
}
while (!isValidAnswer(answer));
answers[i]=answer;
}
//Process
DriveExam exam= new DriveExam(answers);
displayResult(exam);
}
private static void displayResult(DriveExam exam) {
//Result
System.out.println("Result:");
exam.displayUserAnswers();
// outputting Total correct
System.out.println("Total Correct:"+ exam.totalCorrect());
//outputting total incorrect
System.out.println("total incorrect:"
+exam.totalInCorrect());
String passed = exam.passed()? "Yes ":" No";
// result pass or fail
System.out.println ("Passed :" +passed);
if (exam.totalInCorrect()>0)
{
System.out.println("List of Questions Missed :");
int missedIndex;
for (int i = 0; i < exam.totalInCorrect();i++)
{
missedIndex = exam.questionMissed()[i]+1;
System.out.print(" "+missedIndex);
}
}
}
// return true when the answer is valid
public static boolean isValidAnswer(String answer)
{
return "A".equalsIgnoreCase(answer)||
"B".equalsIgnoreCase(answer)||
"C".equalsIgnoreCase(answer)||"D".equalsIgnoreCase(answer);
}
}
_________________________
Output:
Driver's Lincense Exam
20 Multiple choice questions
1:B
2:A
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:A
19:D
20:B
ResultStudent Answers :
B A A A C A B A C D B C D A D C C A D B
Total Correct:17
total incorrect:3
Passed :Yes
List of Questions Missed :
2 18 20
_______________Could you plz rate me well.Thank You
The local driver’s license office has asked you to write a program that grades the written...
PYTHON CODE PLEASEEEEE. Driver’s License Exam 20PTS PYTHON AND FLOWCHART The local driver’s license office has asked you to design a program that grades the written portion of the driver’s license exam. The exam has 20 multiple choice questions. Here are the correct answers: 1.B 6.A 11.B 16.C 2.D 7.B 12.C 17.C 3.A 8.A 13.D 18.B 4.A 9.C 14.A 19.D 5.C 10.D 15.D 20.A Your program should store these correct answers in an array. (Store each question’s correct answer in...
Java: 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 20 multiple choice questions. Here are the correct answers: 1. B 6. A 11.B 16. C 2. D 7. B 12.C 17. C 3. A 8. A 13.D 18. B 4. A 9. C 14.A 19. D 5. C 10. D 15.D 20. A Your program should store the correct answers in an array. (Store each question's answer in an element of a String array.) The program...
please only use import java.util.Scanner 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 20 multiple choice questions. Here are the correct answers: 1. A 2. D 3.В 4. B 5, C 6. В 7. A 8.В 9, C 10. D 12. C 13. D 14. B 15. D 16. С 18. A 19. D 20. B Your program should store...
Using C++ 1. Driver's The local driver's license office has asked you to create an application that grades the written portion of the driver's license exam. The exam has 20 multiple-choice questions. Here are the correct answers 16. C 17.С 18. B 19. D 20. A 1. B 2. D 3. A 12. C 13. D 14. A 15. D 7.В 9.С 10. D 5. С Your program should store these correct answers in an array. It should ask the...
Visual Basic zoow Driver's License Exam The local Registry of Motor Vehicles oflice has asked you to create an application that grades the written portion of the driver's license exam. The exam has 20 multiplc choice questions. Her ar the orrect answers to the questions: 6. A 7.13 8. A 9. C 10. D 16. С 12. C 13. D 14. A 15. D 2. D 3. A 5, C Your application should slore the correcl answers in an array....
License test The Los Angeles driver's license office has asked you to create an application that grades the written portion of the drivers license test. The test has 15 multiple-choice questions. Here are the correct answers (You may create your own correct answers if you like) 1. C 2. D 3. B 4. A 5. C 6. D 7. B 8. A 9. C 10. D 11. A 12. C 13. D 14. A 15. B A student must answer 10...
You have been asked to write a program to grade several multiple-choice exams. The exam has 20 questions, each answered with a letter in the range of ‘a’ through ‘f’. The answers key is declared in the program as constant of type string. An example of answer key is “abcdefabcdefabcdefab”. Your program should work for any other answer key. The program should first ask users for the number of students to be graded. Then it should have a while loop...
Please answer Question 4 WITH A C# PROGRAM!!!!!! THANK YOU! File Edit View History Bookmarks Tools Help Share GEP IIIA Moorhead, MN 10-Day Weathe X N NDSU Faculty and Staff | North x D C#.NET - CSCI 213: Modern Sol X VitalSource Bookshelf: Starting x + + → OO - https://bookshelf.vitalsource.com/#/books/9780134400433/cf1/6 90% *** * Cambie Meble alle... S N 10 Crosby Derek Lam ... Alterna Caviar Anti-Ag... U C# Tutorial For Beginn... BE Celsius Fahrenheit con... Charter Club Sweater. Folklorama...
Objective: write a program that grades multiple-choice test ¡ Each question counts 1 credit. Display the final score for each student. Students’ answer 0 1 2 3 4 5 Student 0 A B A C C D Student 1 d B A B C A Student 2 e D d A C B Student 3 C B A E D C Key to the Questions 0 1 2 3 4 5 Key D B D C C D ¡ Here...
3. Define a class License. A License has a license number and an suggest using java.time.LocalDate, but there are other possibilities). Then do the following: expiration date ( (a) Think what it might mean for two License instances to represent the same real- world license. Write the Boolean equals method that takes another License as argument and returns true if the two Licenses are "equal" in this sense. The block comment for your method should explain how you are doing...