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
harkovskaia [24]
2 years ago
12

Design and implement a program that reads a series of 10 integers from the user and prints their average. Read each input value

as a string, and then attempt to convert it to an integer using the Integer.parseInt method. If this process throws a NumberFormatException (meaning that the input is not a valid number), print an appropriate error message and prompt for the number again. Continue reading values until 10 invalid integers have been entered.
Computers and Technology
1 answer:
irina [24]2 years ago
3 0

Answer:

Explanation:

The following program was written in Java. It creates a loop that asks the user for numbers. If it can convert it to an integer it accepts it and adds it to the sum variable otherwise it ouputs that it is not a valid number. Once all 10 integers are added it prints the Average of the values entered.

import java.util.ArrayList;

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       int count = 0;

       int sum = 0;

       while (count != 10) {

           System.out.println("Enter a number: ");

           String answer = in.nextLine();

           try {

               int intAnswer = Integer.parseInt(answer);

               sum += intAnswer;

               count += 1;

           } catch (NumberFormatException e) {

               System.out.println("Not a valid number.");

           }

       }

       int average = sum / count;

       System.out.println("Average: " + average);

   }

}

You might be interested in
Yall rachits and yall eat butt xD
Trava [24]
Please use this for questions.
6 0
3 years ago
Read 2 more answers
Jenny needs to record the names of 30 students, write down the subjects they studied, and note their grades in each subject afte
Marina86 [1]
The correct answer for this question is this one: "She can rename the 2 worksheet by right clicking the sheet tab. After right clicking the mouse, select Rename Sheet and type the preferred name of the sheet."  Hope this helps answer your question and have a nice day ahead.
5 0
3 years ago
Read 2 more answers
Which element of a business document provides additional information but is not a part of the body of the text?
Vaselesa [24]

The subject is generally covered inside the body of text, so that one's out.

The footer is a completely separate part of the document, specifically the bottom-most portion of the page, but let's look at the others.

The salutation is placed at the beginning of the body of text.

And your closing note is placed at the end of the body of text.

So, the best answer would be b. footer.

3 0
3 years ago
Read 2 more answers
45. Our goals are a reflection of our:
ZanzabumX [31]
Values hope it helps you
4 0
2 years ago
A. Assume a computer has a physical memory organized into 64-bit words. Give the word address and offset within the word for eac
Galina-37 [17]

Answer:

Check the explanation

Explanation:

For 9th byte , it is from 8*8 bit to 9"8th bit so each word consists of 64 bits , to find word address u have to divide 8*8 by 64.

Offset within word = 9*8modulo 64.

For 27th byte , word address = 8*27/64.

Offset within word = 27* 8 modulo 64

For 21th byte , word address = 8*31/64

Offset within the word = 31*8 modulo 64

For 120 , word address = 8*120/64

Offset within the word = 120*8 modulo 64.

7 0
3 years ago
Other questions:
  • Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending whe
    12·1 answer
  • A label is any word that appears in a cell of a spreadsheet.<br> True<br> False
    5·2 answers
  • In Florida no fault insurance is optional for owners of a vehicle
    6·1 answer
  • Given two Generic variables, A with value "123" and B with value 456, what would the Write Line output of A + B be? 123456 579 A
    5·1 answer
  • Callie Crystal owns and operates one of the most successful local coffee shops in Denver, called The Edgewater Café. Each time a
    5·2 answers
  • You can use a(n) to call a function in response to an event?
    14·1 answer
  • Which attribute defines the file name for the specific image in an image tag??
    13·1 answer
  • ...................You like swamps
    13·2 answers
  • Which program will have the output shown below?
    7·1 answer
  • User defined blocks of code can be created in
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!