View the step-by-step solution to:

Attached is a form that needs code written. The form is an answer key for a Driver's exam. There are 20 combo boxes and the user should be able to...

Attached is a form that needs code written.  The form is an answer key for a Driver's exam.  There are 20 combo boxes and the user should be able to choose either A, B, C, or D.  Here is the answer key to the test.
1.  B       11.  B
2.  D       12.  C
3.  A       13.  D
4.  A       14.  A
5.  C       15.  D
6.  A       16.  C
7.  B       17.  C
8.  A       18.  B
9.  C       19.  D
10. D       20.  A
Once the user plugs in his answers, he will then click the "Score Exam" button and another form should pop up showing whether each question was answered correctly or incorrectly and whether the student passed or failed.  The student needs 15 correct answers to pass. You may take the liberty to create the 2nd form.  Please keep it very similar to the first form.  Also, i am sending the form in a zip format.  Please send it back in the same format.  Thanks!! In which i have or the intructions are not clear.  If they are not clear pls return posting with info you need.  I pasted what I have so far and attached what I am suppose to do with this posting to make it more clear. I need this ASAP!
Here is what i have so far
package cis110.lab6;
/**
* DriverExam class
*/

public class DriverExam
{
// Array containing the correct answers
private char[] correct = { 'B', 'D', 'A', 'A',
'C', 'A', 'B', 'A',
'C', 'D', 'B', 'C',
'D', 'A', 'D', 'C',
'C', 'B', 'D', 'A' };

private char[] student; // The student's answers
private int[] missed; // The missed question numbers
private int numCorrect = 0; // The number correct
private int numIncorrect = 0; // The number incorrect

/**
* Constructor
* Accepts an array of the student's
* answers as the argument. The contents
* of the array are copied to the student
* field.
*/

public DriverExam(char[] s)
{
student = s;
gradeExam();
}

/**
* gradeExam method
* This method determines the number of
* correct and incorrect answers. It calls
* the makeMissedArray method.
*/

private void gradeExam()
{
// Create string array to hold correct answers
String[] key = new String[20];

// Create string array to hold student's answers
String[] StudentAnswers = new String[20];

public int totalCorrect(String[] StudentAnswers)
{
int correct = 0;
for (int cor = 0; cor <= StudentAnswers.length; cor++)

if (StudentAnswers[cor].equals(student[cor]))
{correct++;
}


return correct;
}

// Field to return the total incorrect answers
public int totalIncorrect(String[] StudentAnswers)
{
int incorrect = 0;
for (int correct = 0; correct <= StudentAnswers.length; correct++)
{
if (StudentAnswers[correct].compareTo(student[correct])!=0)
incorrect++;
}

return incorrect;
}

// Field to return the question the student missed
public int questionsMissed(String[] StudentAnswers, int missed)
{
int miss = 0;
{
if (StudentAnswers[miss].compareTo(student[numCorrect])!=0)
miss = missed;

return missed;
makeMissedArray();
}
}






public void makeMissedArray()
{
missed = new int [numIncorrect];

}


/**
* makeMissedArray method
* This method makes the missed array and
* stores the numbers of all the questions
* that the student missed in it.
*/


/**
* passed method
*/

public boolean passed()
{
boolean status;

if (numCorrect >= 15)
status = true;
else
status = false;

return status;
}

/**
* totalCorrect method
*/

public int totalCorrect()
{
return numCorrect;
}

/**
* totalIncorrect method
*/

public int totalIncorrect()
{
return numIncorrect;
}

/**
* questionsMissed method
* Returns an array containing the numbers
* of the missed questions. If no questions
* were missed, returns null.
*/

public int[] questionsMissed()
{
return missed;
}

}

then this is the main class below to run the whole project
package cis110.lab6;
import java.util.Scanner;

/**
* DriverTest program.
*/

public class DriverTest
{
public static void main(String[] args)
{
// Constant for the number of answers
final int NUM_ANSWERS = 20;

// Array to hold the student's answers
char[] answers = new char[NUM_ANSWERS];

// This will reference an array holding the
// question numbers of the missed questions.
int[] missedQuestions = null;

// Create a Scanner object for keyboard input.
Scanner keyboard = new Scanner(System.in);

// Get the user's answers to the questions.
System.out.println("Enter your answers to the " +
"exam questions. (Make sure " +
"Caps Lock is ON!)");

for (int i = 0; i < answers.length; i++)
{
System.out.print("Question " + (i + 1) + ": ");
String input = keyboard.nextLine();
answers[i] = input.charAt(0);

// Validate the answer.
while (!valid(answers[i]))
{
System.out.println("ERROR: Valid answers are " +
"A, B, C, or D.");
System.out.print("Question " + (i + 1) + ": ");
input = keyboard.nextLine();
answers[i] = input.charAt(0);
}
}

// Create a DriverExam object.
DriverExam exam = new DriverExam(answers);

// Get an array of the missed question numbers.
missedQuestions = exam.questionsMissed();

// Display a report.
System.out.println("Correct answers: " +
exam.totalCorrect());
System.out.println("Incorrect answers: " +
exam.totalIncorrect());

// Display whether the student passed or failed.
if (exam.passed())
System.out.println("You passed the exam.");
else
System.out.println("You failed the exam.");

// Display a list of missed questions, if any.
if (missedQuestions != null)
{
System.out.println("You missed the following questions:");
for (int i = 0; i < missedQuestions.length; i++)
System.out.print(missedQuestions[i] + " ");
}
}

/**
* valid method
* Returns true if the argument is A, B, C, or D.
*/

public static boolean valid(char c)
{
boolean status;

if (c == 'A' || c == 'B' || c == 'C' || c == 'D')
status = true;
else
status = false;

return status;
}
}
CIS 110 Object-Oriented Programming Spring 2010 Instructor: Weimin He Lab #6 Due Time: in lab class on Friday, April 30th, 2010 1 Description The local driver’s license o–ce 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 A student must correctly answer 15 of the 20 questions to pass the exam. Given a class named DriverExam in the flle DriverExam.java that has the following flelds: ² correct : A char array to hold the correct answers to the questions. ² student : A char array to hold the student answers to the questions. ² missed : A char array to hold the missed question numbers. ² numCorrect : An int to hold the total number of correctly answered questions. ² numIncorrect : An int to hold the number of questions answered incorrectly by the student. In addition, the DriverExam class has the following methods: ² passed : This method returns true if the student passed the exam, or false if the student failed the exam. ² totalCorrect : This method returns the total number of correctly answered questions. ² totalIncorrect : This method returns the total number of incorrectly answered questions. ² questionsMissed : This method returns an int array containing the question numbers of the questions that the student missed. The program that demonstrates the DriverExam class is also given in the flle DriverTest.java . You are required to read and understand the given programs, flll in the missing code in the DriverExam class to make the programs complete and work properly. You are NOT allowed to make any change to the given flle DriverTest.java . 1
Background image of page 1
2 Grading Grading Item Scores The program can be compiled without any error messages 10 The program can be run without any error messages 10 The DriverExam class has the correct implementations of the methods 20 The program can print out correct information on the screen based on the user input 30 No any change is made on the given flle DriverTest.java 10 Nice comments and proper indentations are used in the program 10 Compress all Java source flles into a single flle Lab6.zip and upload it to your UWSP Webspace 10 3 Notice ² You are required to demo your lab assignment in the lab class on Friday. ² The lab will be graded in the lab class and can NOT be regraded after the lab class. 2
Background image of page 2

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question