CODE IN JAVA design a program that grades arithmetic quizzes as follows: (Use the below startup code for Quizzes.java and provide code as indicated by the comments) 1. Ask the user how many questions...


CODE IN JAVA


design a program that grades arithmetic quizzes as follows: (Use the below startup code for Quizzes.java and provide code as indicated by the comments)



1. Ask the user how many questions are in the quiz.



2. Use a for loop to load the array.  Ask the user to enter the key (that is, the correct answers). There should be one answer for each question in the quiz, and each answer should be an integer. They can be entered on a single line, e.g., 34, 7, 13, 100, 8 might be the key for a 5-question quiz. You will need to store the key in an array called "key".



3. Ask the user to enter the student's answers for the quiz to be graded.  There needs to be one answer for each question. Note that each answer can simply be compared to the key as it is entered.  If the answer is correct, add 1 to a correct answer counter.  need this in a separate for loop from the loop used to load the array.



4. When the user has entered all of the answers to be graded, print the number correct and the percent correct.



5. When this works, nest your for loop and output statements  in a  do....while loop so that the user can grade any number of quizzes with a single key. After the results have been printed for each quiz, ask "Grade another quiz? (y/n)."



//******************************************************************
//  Quizzes.java
//  Grades multiple choice quizzes.
//******************************************************************


import java.util.Scanner;
import java.text.NumberFormat;


public class Quizzes
{
   //----------------------------------------------
    // Read in the number of questions followed by
    // the key, then read in each student's answers
    // and calculate the number and percent correct.
    //----------------------------------------------


  public static void main(String[] args)
    {
   int numQuestions;
   int numCorrect;
   String anotherQuiz;
   int answer;
   NumberFormat percent = NumberFormat.getPercentInstance();
   Scanner scan = new Scanner (System.in);


   System.out.println ("Quiz Grading");
   System.out.println ();
   System.out.print ("Enter the number of questions on the quiz: ");
   numQuestions = scan.nextInt();



   //CREATE THE ARRAY FOR THE KEY



   System.out.print ("Enter the answer key: ");




   //LOAD THE ARRAY FOR THE ANSWER KEY WITH INPUT FROM THE USER




   //OUTER LOOP TO ALLOW THE USER TO ENTER GRADES


   // FOR ANY NUMBER OF QUIZZES




         System.out.print("Enter the student answers: ");



    //INNER LOOP TO GET ANSWERS FROM THE USER AND COUNT THE NUMBER OF


    // CORRECT ANSWERS



    //DISPLAY THE NUMBER OF CORRECT ANSWERS AND PERCENT



    //ASK USER IF THEY WISH TO GRADE ANOTHER QUIZ


Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here