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
Rasek [7]
3 years ago
13

write a java program that prompts the user to enter scores (each number an integer from 0 to 10) and prints the following output

: how many scores entered the highest score the lowest score the average of all the scores the average with the highest and lowest score not counted if the user enters less than 3 scores print an error message instead of the output above
Computers and Technology
1 answer:
Vladimir [108]3 years ago
4 0

Answer:

Explanation:

The following is written in Java. It continues asking the user for inputs until they enter a -1. Then it saves all the values into an array and calculates the number of values entered, the highest, and lowest, and prints all the variables to the screen. The code was tested and the output can be seen in the attached image below.

import java.util.ArrayList;

import java.util.Arrays;

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       int count = 0;

       int highest, lowest;

       ArrayList<Integer> myArr = new ArrayList<>();

       while (true) {

           System.out.println("Enter a number [0-10] or -1 to exit");

           int num = in.nextInt();

           if (num != -1) {

               if ((num >= 0) && (num <= 10)) {

                   count+= 1;

                   myArr.add(num);

               } else {

                   System.out.println("Wrong Value");

               }

           } else {

               break;

           }

       }

       if (myArr.size() > 3) {

           highest = myArr.get(0);

           lowest = myArr.get(0);

           for (int x: myArr) {

               if (x > highest) {

                   highest = x;

               }

               if (x < lowest) {

                   lowest = x;

               }

           }

           System.out.println("Number of Elements: " + count);

           System.out.println("Highest: " + highest);

           System.out.println("Lowest : " + lowest);

       } else {

           System.out.println("Number of Elements: " + count);

           System.out.println("No Highest or Lowest Elements");

       }

   }

}

You might be interested in
after installing a secondary hard drive what needs to be done to the hard drive and what do these two task do?
elena55 [62]
HEY heheh ehehhegeeh
3 0
4 years ago
What type of machine is a hand drill?<br><br> A. Simple machine <br> B. Compound machine
Shalnov [3]
<span>It is a Compound machine.</span>
7 0
4 years ago
Read 2 more answers
A local area network is: a large central network that connects other networks in a distance spanning exactly 5 miles. a group of
igomit [66]

The correct answer is a group of personal computers located in the same general area and connected by a common cable.

8 0
3 years ago
Select the correct text in the passage.
chubhunter [2.5K]

Answer:

The last bracket "define project scope and assumptions, estimate cost, create project feature requirements, and note risks."

Explanation:

Project proposals are showing the audience what the project is, how much it will cost them, necessary requirements to achieve, and risks (financial, physical, etc..). That sentence covers all of that.

5 0
3 years ago
Cuáles son las redes sociales que más utilizas tú y tu familia. Describe su utilidad.
Ymorist [56]

Answer:

Facebok

Explanation:

we are able to see everthing other people do and are able to limit what are kids do

6 0
3 years ago
Other questions:
  • Explain why blocking ping (ICMP echo request) packets at an organization's edge router is not an effective defense against ping
    11·1 answer
  • What type of media can be edited and published by anyone?
    6·2 answers
  • Suppose that TCP's current estimated values for the round trip time (estimatedRTT) and deviation in the RTT (DevRTT) are 400 mse
    9·1 answer
  • To carry computer data over the long haul, wans need to have a(n) ________ in multiple towns and cities.
    10·1 answer
  • The Beaufort Wind Scale is used to characterize the strength of winds. The scale uses integer values and goes from a force of 0,
    10·1 answer
  • What is java programing <br>​
    12·2 answers
  • What is the difference between a prefix and postfix in Java?
    5·1 answer
  • 100 POINTS PLEASE HELP Type the correct answer in the box. Spell all words correctly.
    15·1 answer
  • What type of information is appropriate for headers and footers? Check all that apply.
    5·2 answers
  • PUBG mobile id and name plz
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!