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
In five to ten sentences, explain what netiquette is and how it improves efficiency and productivity in the workplace.
dlinn [17]

Netiquette is a form of communication done correctly online. Good netiquette involves respecting others privacy, using correct grammar, and not doing anything online that will annoy or disrupt others. It is important to have netiquette while online, because communication online is non verbal and you can’t tell how someone is reacting. Having netiquette is important. It implies that you have polite behaviors, and want to build up relationships with people in your work space or at a party you plan on attending. Netiquette is one way to show respect to a person, and to show that you deserve respect. It improves how you organize your writing, and shows how productive you can be. By helping you to become polite online and respectful to other users of the internet, Netiquette is especially important for future letters, emails, or other writing forms.


4 0
3 years ago
Read 2 more answers
When a signal travels across network medium, it signal loses strength the further it gets from the transmitting station, to the
neonofarm [45]

Answer:

Attenuation.

Explanation:

Attenuation means a gradual reduction in the strength of a signal as it moves from station to station which may even cause the receiving station to misinterpret the signal. Any signal can be attenuated - digital or analog.

Attenuation is often caused by weakness, fatigue or passiveness of networking cables and connectors. It could also be caused by noise and long distance.

To get around this, the network device(s) will often resend signals multiple times over just to ensure that at least one of the signals gets there and is interpreted correctly.

3 0
3 years ago
The sales management team requires that the Lead Source field of the Lead record be populated when a Lead is converted. What wou
Sav [38]

Answer: A. Validation rule

Explanation:

Validation rules can be used to ensure that fields are populated because they can verify if the data being inputted meet the requirements of the administrators by returning a 'True' or 'False' response after testing. If the result is false, the user will be unable to move on until they adjust the field.

For example, Field length checks on websites are a Validation rule where you are only allowed to input a set number of characters and anything less or more will be denied, such as in the case of inputting phone numbers.

By including a Validation Rule that the LeadSource field of the Lead record be populated when a Lead is converted, the developer will be able to make sure that a user populates the Lead Source field prior to converting a Lead.

5 0
3 years ago
you have a website that customers use to view product information and place orders. You would like to identify the maximum numbe
notka56 [123]

Answer:

a load tester.

Explanation:

Based on the information provided within the question it can be said that in this situation the tool that you should use is known as a load tester. This tool allows you to test your servers in order to see how it behaves under both normal conditions as well as the anticipated peak load conditions that it may be encountering in the near future. Which is exactly what you need for your website.

4 0
3 years ago
a key part of staying safe is employing good habits. drag the step number to the proper sequence triple a
solong [7]

Answer:

where are the step number. I can't find any

6 0
3 years ago
Other questions:
  • SMART PEOPLE NEEDED
    11·1 answer
  • A client accessing a network share folder has authenticated into the system and has full access rights to a folder share. But af
    11·1 answer
  • In codd's model of a relational database, data is stored in a(n) _____, which maintains information about a(
    7·1 answer
  • Create a class named Console, and move all the methods that retrieve and validate user input to that class. These methods can re
    7·1 answer
  • In Microsoft Word you can access the _______ command from the "Mini toolbar." 
    9·1 answer
  • Match each of the following steps of SDLC development to its position in the development process.
    15·1 answer
  • Hi guys, Im making a game. I want to make a collision event, but what is the code for making the wall and the box collide. I rea
    6·1 answer
  • A student registers for a course in a university. Courses may have limited enrollment i.e a student must
    5·1 answer
  • Which terms represent the two types of client requirements?
    7·2 answers
  • when you insert a new column, the existing columns are shifted to the ____ and the new column has the same width as the column d
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!