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
Choose an ethical person you admire. This could be someone you know (such as a parent, friend, or teacher) or someone you don’t
Andrews [41]
HEY THERE!!

I will chose my sister though we have not blood relation but then she is my ideal . i love her so much and i respect her a lot , much more then a real sister . She is everything to me. She guides me in my study amd after meeting her i am completely changed.

I m an INDIAN and she is an Pakistani i met up with her in brainky amd now i don't wanna loss her ever.

Love you sis .
8 0
4 years ago
An online apparel website aims to rank on top in the search engine results. Which technique will help the business list itself a
Alex

Answer:

A. using exclusive keywords such as "leather jacket" in an image

Explanation:

A. is the correct answer. This is because generic keywords are hard to be ranked for, as they are general for all. And using exclusive keywords like "while winter jacket" will do but if we use even better keywords like the leather jacket with image will work even better, as Google prefers the images, and as an example an infographic over an article. And it prefers a video over an image, and so forth. And never ever link to phishing websites, the Search engine will ban you.

8 0
4 years ago
Read 2 more answers
What is programming blocks?
charle [14.2K]

Answer:

In computer programming, a block or code block is a lexical structure of source code which is grouped togethe

Explanation:

3 0
3 years ago
Suppose we are comparing the implementations of insertion sort and merge sort on the same machine(You don’t need to know the alg
Anuta_ua [19.1K]

Answer:

123456789o0

Explanation:

4 0
3 years ago
Why hackers hack?? in other people?​
pshichka [43]
Could you please reword this question. i don’t get what you’re asking
8 0
3 years ago
Read 2 more answers
Other questions:
  • Question 1 : Which statement is true about interlaced images? This task contains the radio buttons and checkboxes for options. T
    8·1 answer
  • Drivers must always yield to emergency vehicles traveling
    9·1 answer
  • c++ design a class named myinteger which models integers. interesting properties of the value can be determined. include these m
    14·1 answer
  • The amount of vertical space between lines within paragraphs
    9·1 answer
  • How you will install an operating system on your computer
    5·1 answer
  • What is a mechanical gear and how does it work to create more power?
    13·1 answer
  • List the memory units inside and outside of the CPU, along with short descriptions of their
    11·1 answer
  • An animation is made up of individual images called _______________.
    11·1 answer
  • What is the purpose of including comments in code?
    15·1 answer
  • Tamera was responding to a complaint that one of the employees is having problems with the wired network connection on their lap
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!