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
Veronika [31]
3 years ago
7

Write a program with a loop that lets the user enter a series of positive integers. The user should enter −1 to signal the end o

f the series. The program should count all the numbers entered, compute the running total of the numbers and displays their count, total and average. Display average to decimal places.
Computers and Technology
1 answer:
Fiesta28 [93]3 years ago
5 0

Answer:

import java.util.Scanner;

public class num2 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       int count =0;

       int total = 0;

       System.out.println("Enter the numbers");

       int num = in.nextInt();

       while(num!=-1){

           total = total+num;

           count++;

           System.out.println("Enter the next number");

           num = in.nextInt();

       }

//Compute the average

       double average = (double) total/count;

//Outputs

       System.out.println("Total count of numbers entered "+(count));

       System.out.println("Sum of the numbers "+total);

       System.out.printf("Average is %.2f ",average);

   }

}

Explanation:

  • Using java programming language
  • Import scanner class to receive user input
  • declare variables count and total and initialize to zero
  • Prompt user to enter numbers
  • Use a while statement with the condition while(num!=-1)
  • Within the while body keep prompting user to enter a number, increase count and update total
  • when -1 is entered the loop breaks and average is calculated
  • Use printf() method to print average to 2 decimal places.
You might be interested in
A robot can complete 7 tasks in hour. Each task takes the same amount of time.
bekas [8.4K]

Answer:

A. I believe is 8.57

B. Should be 7

Explanation:

Please forgive me if I'm wrong thats my best shot. However if i am right please mark brainliest

3 0
4 years ago
Read 2 more answers
Authorization is a set of rights defined for a subject and an object. They are based on the subject’s identity.a. Trueb. False
SVEN [57.7K]

Answer:

True

Explanation:

Authorization is a set of rights defined for a subject and an object. They are based on the subject’s identity.a. Trueb. False

Authorization is a set of rights defined for a subject and an object.

Authorization is a security mechanism used to determine user/client privileges or access levels related to system resources, including computer programs, files, services, data and application features. Authorization is normally preceded by authentication for user identity verification.

4 0
3 years ago
What is this on G00gel Documents , how do I fix it?
mylen [45]

Answer:

Sorry but it donest show the picture

Explanation:

7 0
2 years ago
Will give Brainliest 100 points answer only if you know
katrin [286]
There are five basic programming elements, or operations: input, output, arithmetic, conditional, and looping. Every program uses at least two of these.

The description of a programming language is usually split into the two components of syntax (form) and semantics (meaning).

Input: getting data and commands into the computer

Output:getting your results out of the computer

Arithmetic: performing mathematical calculations on your data

Conditional: testing to see if the condition is true or false

Looping: cycling through a set of instructions until some condition is met
7 0
3 years ago
Read 2 more answers
Google's stated mission is to: establish itself as the most valuable media company in the world. organize the world's informatio
pickupchik [31]

Answer:

Yes this is true.

Explanation:

7 0
3 years ago
Other questions:
  • Jean-Ann works in the finance business. She analyzes insurance applications in order to determine the level of risk involved in
    11·1 answer
  • Which of the following is true about a point-and-shoot camera? They always have lenses that you can take on and off. They are of
    8·2 answers
  • When you define a table's primary key, the dbms automatically creates a(n) _____ index on the primary key column(s) you declared
    14·1 answer
  • The _____ is the area in Microsoft Excel where you can perform file commands such as Save, Open, and Print
    5·2 answers
  • Write a function named sortie that takes three integer parameters by reference and rearranges them in ascending order--the first
    6·1 answer
  • Keep the base of your _________ on the mouse pad or desk?
    12·2 answers
  • Differentiate between the broadcasting and telecommunication
    5·1 answer
  • What came after the Phonograph
    13·2 answers
  • What is software and explain the five types of software
    5·2 answers
  • Meat and poultry exposed to some forms of radiations to extend shelf life. *
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!