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
How many times is the function wordScramble() called in the given program? public class WordScramble { public static void wordSc
Ainat [17]

Answer:

The answer is "2"

Explanation:

  • In the given java program code, a class WordScramble is declared, inside the class, a static method wordScramble is declared, that accepts two string parameter that is "rem and scr".
  • Inside the method a conditional statement is used in the if the block it checks rem variable value is empty so, it will add rem and scr value.  Otherwise, it will go to else block in this a loop is defined, which calls the method, which calculates rem length that is 2, and this method call two times to rearrange the values.
  • In the next step main method is defined that calls wordScramble method, which passes only one argument "ab" in its first parameter.
  • This method accepts one string value, in which there are two numbers   "a and b" that's why the method will run two times.  
6 0
3 years ago
The United States Army retains a history of all equipment acquisition from approval of requirements through funding, authorizing
Mama L [17]

Answer:

A. data mart

Explanation:

Data mart refers to a structure for storing and retrieving data. Often times, the data mart is usually specific to a business line.

The data contained herein is also specific to a particular department and by so doing this facilitate easy isolation, use and development of the data.

The major advantage of creating data marts is for easy accessibility of data.

7 0
3 years ago
Researching the history of computers is a good troubleshooting technique.<br> True or False?
Verdich [7]

Yes very much so! You could learn previous mistakes/bugs/etc and find solutions to fixing them and avoiding getting them. As well as much more. History is always a fun subject for anything, really in my opinion.

4 0
2 years ago
Whose massively popular photo led to the creation of google images?
Alex
Jennifer Lopez’s picture led to the creation of google images.
5 0
3 years ago
When computer users have trouble with their machines or software, Roland is the first person they call for help. Roland helps us
Schach [20]

Answer:

The correct answer is A) Support Analyst

Explanation:

From the question, we can see that Roland is familiar with both machines and software. He is familiar with the operations of both parts of a computer to the end that he can attempt a fix. And if he can't he knows who to refer the end-users to. Usually, some IT personnel that is more experienced.

From the above points, we can safely say that Roland is an IT Support Analyst. He cannot be the Systems analyst because Systems Analysts are usually at the top of the Pyramid. They take on problems that are referred upwards to them from support analysts.

Cheers

3 0
2 years ago
Other questions:
  • You have found statistics on the Internet that you would like to use in your speech.
    6·1 answer
  • Works in the public domain have copyright that are expired or abandoned true or false
    5·1 answer
  • Write a program named as calcPrice.c that formats product information entered by the user and calculate the total amount of purc
    5·1 answer
  • A string s is a circular shift of a string t if it matches when the the characters are circularly shifted by any number of posit
    9·1 answer
  • According to which virtue do you need to secure information by limiting computer access to authorized personnel only?
    6·1 answer
  • Advantages of Linux include_____.
    6·1 answer
  • Which of the following is used to move to end of the row?​
    8·1 answer
  • In this class, it is very common for your computer screen to look like this. What is this?​
    5·1 answer
  • If there are 18 people in your class and you want to divide the class into programming teams of 3
    7·1 answer
  • What are the local, state, and national opportunities that may be available to those who participate in CTSOs?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!