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]
2 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]2 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
What are career values
NikAS [45]

Answer:hdhfnrjrjkejd

Explanation:

4 0
3 years ago
You have just purchased a server with Windows Server 2016 Datacenter Edition installed. The server has 4 GB RAM, a 200 GB hard d
Elena L [17]

Answer:

a. Install more RAM

Explanation:

According to my research on information technology, I can say that based on the information provided within the question this server will not work for you purpose unless you install more RAM. This is because Hyper-V server's have a minimum requirement of 4gb, therefore if you want to run 2 servers you can divide all the resources you have since they are enough but not the RAM since you only have the bare minimum for one server. You need to add atleast 4 gb more of RAM.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

4 0
3 years ago
How do you find the exterior angle measure of any regular polygon? (The degree in which to turn the turtle to draw a shape)
Diano4ka-milaya [45]

Answer:

360/number of sides

Explanation:

all the exterior angles add up to 360°

so to find each angle mesure, divide the 360 by the number of sides the figure has.

7 0
3 years ago
I got enough points and enough brainliests how do I move on to my next rank?
emmasim [6.3K]

Answer: what do you mean exactly?

6 0
3 years ago
Read 2 more answers
Hey i need someone to talk to because of life it would be amazing if you can help me
Leya [2.2K]
Talk to you about... :)
3 0
3 years ago
Other questions:
  • (GAME DESIGN)
    15·1 answer
  • What OS is most commonly used by businesses? Linux Macintosh Microsoft Windows
    11·1 answer
  • What is output by the following program? int i = 7; while (i&gt;=2){System.out.print (i +""); if ((i%3) == 0){ i +2; } else { i/
    6·1 answer
  • Why would "ExpirationDate” be a poor choice as a primary key?
    11·1 answer
  • Compare GBN, SR, and TCP (no delayed ACK). Assume that the timeout values for all three protocols are sufficiently long such tha
    11·1 answer
  • What is the best platform for a online meeting?
    10·2 answers
  • question i need a real answer cuase i have a virus cuase off my borther and these are the notifacations i get and now these site
    11·1 answer
  • Directions: Arrange the jumbled letters to make/form a new word. Then give a
    12·1 answer
  • 1 punto
    11·1 answer
  • wooooooooo helll yeaaa made it to ACE baby now road to whatever next, lil present imma be doing You tube soon soo ideas will be
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!