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
U.S. cybersecurity experts and government officials are increasingly concerned about breaches from __________ into corporate net
Triss [41]

Answer:

Organized crime syndicates based in the United State

Explanation:

U.S. cybersecurity experts and government officials are increasingly concerned about breaches from organized crime syndicate based in the United States into corporate networks, either through mobile devices or by other means.

The crime syndicate can go to any length to access corporate network through mobile device or any other means in order to commit crimes that is why the US cyber security expert and government officials are increasingly concerned.

Cyber security specialists or expert in the US are been employed to protect information or data that the crime syndicate may want to gain access to by using different variety of techniques by critically monitoring the systems network for attempted breaches by the crime syndicates and then dealing with any of them that is found guilty.

5 0
3 years ago
HELPPP ME PLEASEEE!!
natita [175]
It’s the last one! The key to an effective persuasion is to know what you want and be clear about your response.
4 0
3 years ago
How to use github to creat a blog?Thank you
stepan [7]
You can use GitHub Pages! They have tutorials on their site to help you set up using that (too much for this format!). You can use it to make your own personal site, as well as host any existing site you may have.
5 0
4 years ago
Which one of the statements best characterizes the current state of e-commerce?
svlad2 [7]

It has been rapidly expanding over the last several years and is expected to continue to expand at an even faster rate.

6 0
3 years ago
Do an Internet search for multiple inheritance in programming languages. What are the pros and cons of multiple inheritance? Why
Andrei [34K]

Answer:

Pros and cons of multiple inheritance

Pros

a) You categorize classes in many different ways. Multiple inheritance is a way of showing our natural tendency to organize the world. During analysis, for example, we use multiple inheritance to capture the way users classify objects.

b) By having multiple superclasses, your subclass has more opportunities to reuse the inherited attributes and operations of the superclasses.

Cons

a) If two classes have a method with the same name, the new subclass doesn't know which one to call.

b) multiple inheritance can lead to a lot of confusion when two base classes implement a method with the same name.

c) The more superclasses your subclass inherits from, the more maintenance you are likely to perform. If one of the superclasses happens to change, the subclass may have to change as well.

d) When a single subclass inherits the same attribute or operation from different superclasses, you must choose exactly which one it must use.

Explanation: Question 2

Some programming languages such as Java don’t allow you to use multiple inheritance. You must translate multiple inheritance into single inheritance or individual Java interfaces. This can be confusing and difficult to maintain because the implemented code for categorizing objects is quite different from the way the user organizes those objects. So, when the user changes their mind or adds another category, it is difficult to figure out how to program the new subclass.

5 0
3 years ago
Other questions:
  • Is a growing network of physical objects that have sensors connected to the internet?
    15·1 answer
  • According to many experts how often should files be backed up
    12·1 answer
  • Jacob would like to include an arrow in his newsletter to point to some important information. He should _____.
    14·2 answers
  • Two ways in which the media does not reflect the society you live in.
    9·1 answer
  • A network administrator notices that some newly installed Ethernet cabling is carrying corrupt and distorted data signals. The n
    5·1 answer
  • What is the promotion and advertising stage of a product or service called?
    15·1 answer
  • Represent the measuring unit ofcomputer un terms of fration of second​
    13·1 answer
  • Output is the act of is the act of entering the data to the computer?​
    10·1 answer
  • Hi this is for computer and technology experts out there but can someone tell me why my dell computer charger wont work please h
    13·2 answers
  • Ginny faced an application error while executing the recorder in opera. Which web browser is generally recommended to use with r
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!