1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sdas [7]
4 years ago
10

1. Write a program that grades arithmetic quizzes as follows: (4 points) a. Assume there are 23 questions in the quiz. b. Ask th

e user to enter the key (i.e., the correct answers). There should be one answer for each question, and each answer should be an integer. The numbers are entered on a single line, e.g., 34 7 13 100 81 3 9 10 321 12 34 7 13 100 81 3 9 10 321 12 9 10 321. c. Ask the user to enter the answers for the quiz to be graded. Store the answers in an array. d. Print the number correct and the percent correct. e. Put the whole program in a do-while loop.
Computers and Technology
1 answer:
const2013 [10]4 years ago
5 0

Answer:

import java.util.Scanner;

public class Grade

{

public static void main(String[] args) {

   

    final int LENGTH = 23;

    int keys[] = new int[LENGTH];

    int responses[] = new int[LENGTH];

    int i = 1, correctCount = 0;

   

    Scanner input = new Scanner(System.in);

    do {

       

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

        int key = input.nextInt();    

        keys[i-1] = key;

       

        System.out.print("Enter your response to question " + i + ": ");  

        int response = input.nextInt();    

        responses[i-1] = response;

       

        if (keys[i-1] == responses[i-1]) {

            correctCount ++;  

        }

        i++;

    }

   

    while(i <= LENGTH);

   

    double percentage = (double)correctCount / LENGTH;

   

 System.out.println("Number of the correct answers: " + correctCount);

 System.out.println("Percentage of the correct answers: " + percentage);

}

}

Explanation:

- Initialize the variables

Inside the do-while loop :

- Ask for the answer key and put the values in keys array

- Ask for the responses and put the values in responses array

- If values at the same position in both arrays are equal, increase the correctCount, that means the response is correct

- Print the correcCount and percentage

You might be interested in
3. Run the C-LOOK algorithm (requests can only be serviced when the head is moving toward higher numbered tracks); the head is c
o-na [289]

Answer:

See explaination.

Explanation:

An algorithm is specifically defined as the step by step method or process of achieving any type of result.

Please kindly see the attached file for the C algorithm that fulfils the answer of the given problem.

3 0
3 years ago
What should I change my fortnite name to:<br> Barneys broken thumb or I dont have aim assist
Ket [755]

Answer: yes

Explanation:

4 0
3 years ago
Allison needs to graph the yearly average snowfall in Alaska. She should use a:
bazaltina [42]

C: bar graph

bar graphs are used to track changes over time, so I would say that C is your best bet

7 0
4 years ago
Read 2 more answers
Face book requires you to change your password regularly<br> a. TRUE<br> b. FALSE
Irina-Kira [14]
The answer is for this question is false
8 0
3 years ago
Help...! Why might you trace an image<br> A. To edit an image<br> B. To make drawing easier
pav-90 [236]

Answer:

the answer is b

5 0
4 years ago
Other questions:
  • What is an LMS and how is it used?
    8·1 answer
  • Which practice is the best option for desktop security? A. Make a unique user ID and password for each account. B. Change the pa
    9·2 answers
  • Over time, smart phones have become _____.
    12·2 answers
  • Who designed analatic engine in the 1930's?​
    10·1 answer
  • Jim wants to buy a car, but he’ll probably only need it for a couple of years. He has a short commute to work, so he won’t be pu
    5·1 answer
  • <img src="https://tex.z-dn.net/?f=%20%3Cmarquee%20behavior%3D%E2%80%9Dscroll%E2%80%9D%20direction%3D%E2%80%9Ddown%E2%80%9D%3EFol
    9·1 answer
  • DRU is a small brokerage house that enables its clients to buy and sell stocks over the Internet, as well as place traditional o
    14·1 answer
  • When should students practice netiquette in an online course? Check all that apply.
    9·1 answer
  • What is the importance of server modules and add-ons?
    9·1 answer
  • There are three groups of people, people who like Apples, Bananas, and Cherries. 19 people like Apples. 23 people like Bananas.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!