with JAVA language (Count positive and negative numbers and compute the average of numbers) Write a program that reads a

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

with JAVA language (Count positive and negative numbers and compute the average of numbers) Write a program that reads a

Post by answerhappygod »

with JAVA language
(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 of run program
Enter an integer the input ends if it is 0:
-44 -33 -12 15 89 45 113 117 45 0
The number of positives is: 6
The number of negatives is: 3
The total is: 335.0
The average is: 37.22
Tips:
Without using method, only main method and Use while with
if statements and scanner, println for input and output
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply