Question
I want to write a program in java that will ask users to enter a sequence of positive integers in a loop. If users enter
I want to write a program in java that will ask users to enter a sequence of positive integers in a loop. If users enter a non-positive number, the program should exit the loop and display the total number of positive integers entered, the average of those positive numbers, and the minimum and maximum values in the list. A sample run of the program will produce the following output. What I have far is:
Scanner kbd = new Scanner(System.in); int number; int maxnum; int minnum; int counter = 0; int total = 0; System.out.println("Please enter a postive interger."); number = kbd.nextInt(); if(number >0); { total = total + number; }
not sure what to do next, I know I may need to use an array somewhere.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started