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
Explain the history of America ​
Tomtit [17]

Explanation:

The history of the United States is what happened in the past in the United States, a country in North America. ... They won the Revolutionary War and started a new country. They signed the constitution in 1787 and the Bill of Rights in 1791.

Military conflict

8 0
3 years ago
Read 2 more answers
What company was affected by the cloudbleed vulnerability?
DIA [1.3K]

The <em>cloud bleed vuneraliblity</em> describes the security flaw which was discovered in 2017 and had affected internet service company CloudFlare and many websites using the company's services.

CloudFlare is a internet service company which operates to provide security of data to millions of websites. However, a glitch occured during a certain security update which led to a loophole which wasn't discovered for months.

This made the user data on CloudFlare's network susceptible over the course of that period. It was reported that companies such as Uber, OKcupid and several others on the CloudFlare security network were affected.

Therefore, the company affected by the cloud bleed vuneraliblity is CloudFlare.

Learn more :brainly.com/question/25018707

7 0
3 years ago
What type of Microsoft Server serves as an email server?
Misha Larkins [42]
I have a feeling you're looking for Microsoft Outlook.
4 0
3 years ago
Read 2 more answers
Select the correct answer from each drop-down menu. Computer memory stores data as a series of 0s and 1s. In computer memory, re
attashe74 [19]

Answer:

Zero (0); one (1).

Explanation:

Boolean logic refers to a theory of mathematics developed by the prominent British mathematician, called George Boole. In Boolean logic, all variables are either true or false and are denoted by the number "1" or "0" respectively; True = 1 or False = 0.

The memory of a computer generally stores data as a series of 0s and 1s. In computer memory, zero (0) represents the absence of an electric signal i.e OFF and one (1) represents the presence of an electric signal i.e ON.

4 0
3 years ago
Which of the following statements best compares and contrasts the role of editors in a television news room and editors at a new
nexus9112 [7]

Answer: It is A

Explanation:

7 0
2 years ago
Other questions:
  • What filter gives a “squeezed” effect to an image?
    14·2 answers
  • Can u suggest me some Hindi movies that is on you-tube please suggest
    7·2 answers
  • Missy creates a personal budget. She enters her current savings account balance in cell D3. In cell A3, she calculates her incom
    13·2 answers
  • To edit the color of the text in presentation software, choose the Font color command Text Color in the ________ ribbon toolbar.
    15·2 answers
  • You’re driving down the highway when one of your tires suddenly blows out.<br> you should
    10·2 answers
  • What is a relationship between a object and a class?
    7·1 answer
  • E-mail has made it very easy to send a message to more than one person at any time of day from just about anywhere. If you wante
    12·2 answers
  • Software applications called _____ provide the means to record information that passes through a computer or router that is hand
    10·1 answer
  • Mihaela I. Croitoru – Utilizarea calculatorului personal Microsoft Word dau coroana
    14·1 answer
  • Please help on both of these questions will give brainliest<br> !!
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!