5-1) (Count positive and negative numbers and compute the average of numbers) Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, and 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 #4: java AvgwithLoop Interactive SessionHide Invisibles Highlight: None Show Highlighted Only D Enter.an.integer, the.input ends.if.it.is.e:-4433.-12.15.89.45 The-number-of. positives is . 6 The number.of.negatives.is.3 The total.is.335.0 The average.is 37.22 113.117.45.8

Question

Use Java to answer the question.

5-1) (Count positive and negative numbers and compute the average of numbers)

Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, and 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.

 

 
5-1) (Count positive and negative numbers and compute the average of numbers) Write a program that reads an unspecified number of integers, determines how many
positive and negative values have been read, and 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 #4: java AvgwithLoop
Interactive SessionHide Invisibles
Highlight: None
Show Highlighted Only D
Enter.an.integer, the.input ends.if.it.is.e:-4433.-12.15.89.45
The-number-of. positives is . 6
The number.of.negatives.is.3
The total.is.335.0
The average.is 37.22
113.117.45.8

Image Transcription

5-1) (Count positive and negative numbers and compute the average of numbers) Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, and 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 #4: java AvgwithLoop Interactive SessionHide Invisibles Highlight: None Show Highlighted Only D Enter.an.integer, the.input ends.if.it.is.e:-4433.-12.15.89.45 The-number-of. positives is . 6 The number.of.negatives.is.3 The total.is.335.0 The average.is 37.22 113.117.45.8

Expert Answer

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times vary by subject and question complexity. Median response time is 34 minutes and may be longer for new subjects.
Tagged in
EngineeringComputer Science

Programing Language

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: Design a Turing machine that computes the function f (x) = x − 2 if x > 2   = 0 i...

A: Click to see the answer

Q: Create a new file in c++ and save it as lab11_XYZ.cpp (replace XYZ with your initials). Create ANOTH...

A: Program Instructions:In the header file, create a temporary variable temp of the data type of each v...

Q: I am trying to read in a text file called "lines.txt" that holds an entire dictionary of words with ...

A: First you need to use the ifstream class object to read from file.

Q: How do I define a recursive function with C++? I am supposed to compute the Fibonacci numbers with a...

A: The algorithm for the recursive Fibonacci series is as below:Start with the first element which is 0...

Q: What values will print? Use Eclipse to verify it and show the steps. double x = Math.sqrt(4);System....

A: Creating the program exemplifying the Java math operators in a class called MathOperators as shown i...

Q: You need to use Eclipse to create this program.

A: Instructions for the first program:Create an array of size 5 and initialize a counter variable named...

Q: Visual Basic. Write the definition of a function named quadratic that receives three double paramete...

A: Formula for quadratic equation:

Q: I am struggling on storing numbers from the getChoice () function into an array and pulling it back ...

A: Click to see the answer

Q: Find a regular expression for the set {anbm : n ≥ 3, m is odd}

A: Regular expression:Given: {an bm: n >=3, m is odd}