0
Who can help me in this assignment on java ?!
Write a program that reads a list of integers from the keyboard and creates the following information: a) Finds and displays the sum and the average of these integers. b) Finds and displays the largest integer of these integers. c) Finds and displays the smallest integer of these integers. d) Displays YES if all of these integers are between 10 and 90 and NO if not. e) Displays YES if some of these integers are less than 20 and NO if not.
2 Antworten
+ 1
im not gonna write the program for you but i'll tell you what you need:
to read user input you can use the Scanner class.
then you need a for loop that loops the wanted amount of inputs.
once you have your inputs you can use another for loop to check all inputs and find the max,min, avg and so on.
You could also check the inputs right after you entered them.
Output is simply done with System.out.println();
0
The input data consist of a list of integers with a sentinel (9999). The program must ask the user to enter the integers, one by one, and enter the sentinel when the end of the list has been reached.
The output should appear as follows:
The sum of all these numbers is -------
The average of all these numbers is -------
The largest number is --------
The smallest number is --------
All these numbers are between 10 and 90: ---------------
Some of these numbers are less than 20: ---------------