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_____refers to the entire Excel file
Veronika [31]
Answer:  workbook

Explanation:
A workbook is the file that holds several worksheets.
The worksheets within a workbook can communicate with each other within the workbook or with other workbooks and their worksheets.
A worksheet within a workbook holds cells that are defined by rows and columns. Worksheets within a workbook can removed and new worksheets can be added.
8 0
3 years ago
Periodically adding, changing and deleting file records is called file. A) Updating B) Upgrading C) Restructuring D) Renewing E)
igomit [66]
Periodically adding, changing and deleting file records is called file updating. The correct answer is A. 
4 0
3 years ago
Read 2 more answers
An email message containing a warning related to a non-existent computer security threat, asking a user to delete system files f
LenKa [72]

Answer: Virus Hoax

Explanation:

A computer virus hoax is a message that warns someone of a false virus threat. It is a a chain email that encourages who ever has received the message to pass it to other people as a form of warning.

5 0
2 years ago
Which of the following techniques would a Baroque composer most likely employ to evoke an affect of agitation? Select one:
frez [133]

Answer:

b. Rubato tremolo

Explanation:

Tremolo is a modulation effect that imposes a rhythmic change in volume of sound. Once discovered in electric amplifier circuits, sound engineers and composers like the Baroque now use this low frequency oscillating modulation technique to create emotional piercing effect on their audience to maintain focus.

The low frequency tremolo can be gotten from the vibrating string in guitars, violins etc, and vocal sound, it is also produced from electronic devices created for its purpose. they are called optical tremolo.

5 0
3 years ago
Does anyone know what the name of the game is, where you click on the grey dots in a 3x3 grid and try to make them all the same
antoniya [11.8K]

Answer:

Its the pattern puzzle game.

Explanation:

The answer is straight forward. Its a pattern puzzle game, and here we need to change everything to same color, and that is a pattern of this pattern game. Many forms of such pattern games are available, but this one happens to be the most popular among them all, and is widely used by various people of all ages to pass their time.

3 0
2 years ago
Other questions:
  • On the food inventory worksheet, enter a function in cell G1 that counts the number of Food Items. What formula would i use!? Th
    5·1 answer
  • Utilities software and word processing software are both eamples of
    10·1 answer
  • What is a good voltage measurement on a brand new, 6 volt golf cart deep cycle battery after the first charging?
    10·1 answer
  • Suppose arraylist list1 is [1, 2, 5] and arraylist list2 is [2, 3, 6]. after list1.addall(list2), list1 is __________.
    8·1 answer
  • The accessibility of a website refers to which of
    6·1 answer
  • Its a zoom call
    7·1 answer
  • What type of things can be marketed
    11·1 answer
  • This refers to the people involved in the data processing operation.
    14·1 answer
  • Which cell formatting is most likely to use $?
    5·1 answer
  • Mobile computing is growing in importance each and every day, and the IT manager must take that into account. Do some web resear
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!