Write a program that grades arithmetic quizzes as follows: 1. Ask the user how m
ID: 3617731 • Letter: W
Question
Write a program that grades arithmetic quizzes as follows:
1. Ask the user how many questions are inthe quiz.
2. Ask the user to enter the key (that is,the correct answers). There should be one answer for each questionin the quiz, and each answer should be an integer. They can beentered on a single line, e.g., 34 7 13 100 81 3 9 10 321 12 might be the key fora 10-question quiz. You will need to store the key in an array.
3. Ask the user to enter the answers forthe quiz to be graded. As for the key, these can be entered on asingle line. Again there needs to be one for each question. Notethat these answers do not need to be stored; each answer can simplybe compared to the key as it is entered.
4. When the user has entered all of theanswers to be graded, print the number correct and the percentcorrect.
When this works, add a loop so that the user can grade anynumber of quizzes with a single key. After the results have beenprinted for each quiz, ask "Grade another quiz? (y/n)."
Explanation / Answer
please rate - thanks import java.util.*; public class untitled {public static void main(String[] args) {Scanner in=new Scanner(System.in); int[] key= new int[50]; int quest,i,correct,ans; char again; System.out.print("How many questions on the quiz? "); quest=in.nextInt(); System.out.print("Enter the answer key "); for(i=0;iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.