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
Naily [24]
4 years ago
8

Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, a

nd computes the total and average of the input values (not counting zeros). Your program ends with the input 0. Display the average as a floating-point number. Sample Run 1
Computers and Technology
1 answer:
nika2105 [10]4 years ago
3 0

Answer:

import java.util.Scanner;

public class NumbersStats {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       int pos = 0, neg = 0, count = 0, num;

       double total = 0;

       System.out.print("Enter an integer, the input ends if it is 0: ");

       while (true) {

           num = in.nextInt();

           if(num == 0) break;

           if(num > 0) {

               pos++;

           } else {

               neg++;

           }

           total += num;

           count++;

       }

       System.out.println("The number of positives is " + pos);

       System.out.println("The number of negatives is " + neg);

       System.out.println("The total is " + total);

       System.out.println("The average is " + (total/count));

   }

}

Explanation:

You might be interested in
PLz answer I really need the answer
zlopas [31]

Answer:

a

Explanation:

job leads

4 0
3 years ago
Read 2 more answers
True or False: Visual Studio is not a part of Unity. You could use a different code editor to edit your C# scripts if you wanted
gizmo_the_mogwai [7]

Answer:

True

Explanation:

Visual Studio and Unity are two different things. Visual Studio is an IDE developed by Microsoft, and Unity is a game engine developed by another company. Visual Studio is the default editor in Unity, but you are able to use something different.

Source: https://docs.unity3d.com/Manual/ScriptingToolsIDEs.html

7 0
3 years ago
5.2
Ray Of Light [21]

Answer:

In order to reduce the risk of accidents on the roads.

Explanation:

The special equipment is used when  testing eyesight for a driver's license in order to reduce the risk of accidents on the roads. Good eyesight is very important for good and safe driving so to find out the eyesight of the driver, the license officer used special equipment in order to check driver's eyes. If the eyesight is good, the officer provide license to the person otherwise not so that no accidents happen on the road.

8 0
3 years ago
What happens if you try to compile and run this program?
dezoksy [38]

Answer:

identifier "G" is undefined

Explanation:

The syntax of the code you provided is incorrect, so you cannot run this program.

7 0
3 years ago
Tasked to install additional RAM in a computer. He unplugs the system from the power source and removes the PC cover. What shoul
Galina-37 [17]

Answer:Put on an ESD(Electrostatic discharge) strap.

Explanation: An ESD wrap which is also known as ground wrap is a sort of a wrap that is tied around the wrist to protect the person electronic equipment's static electricity.  This wrap produces anti static energy which help in not producing any static charge while the technician touches the inner parts of the CPU of other internal parts of the system.

4 0
4 years ago
Other questions:
  • How to check the balance on a visa gift card?
    6·1 answer
  • A growing number of large organizations have built internal Web sites that provide opportunities for online social networking am
    7·1 answer
  • What is the output of the following snippet if the user enters a value of 11 for the variable x and 4 for the variable y? x=int(
    5·1 answer
  • 1. Do you consider Facebook, MySpace, and LinkedIn forms of disruptive or sustaining technology? Why?
    15·1 answer
  • The engine flywheel bolts to the Rotor Pistons Front axle Crankshaft
    13·1 answer
  • People must use telepresence when virtually meeting with a group of co-workers.<br><br> T or F
    8·1 answer
  • Describe how spacecraft evolved from the US Mercury to contemporary space shuttles.
    10·1 answer
  • In dos operating system ,write a command to delete the directory as well as the files of the directory ''world'' on drive E.
    15·1 answer
  • What is the answer to 4.9 Code Practice: Question 2
    14·1 answer
  • When a browser is open on your computer, what browser tool is used to move the webpage to the previously viewed page on the brow
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!