Hello if anyone could help I would appreciate it. The issue I am having with this is that can't seem to figure out what to use for the highest, lowest, sum and average despite getting the random values to spit out.
Write a Java program that will allow a user to specify how many random numbers he/she would like to be generated between 1 and 100. Then produce the random and list them in your output. You should also compute the highest, lowest, sum and average. Output should be neat and user friendly. You may find that the output would be much nicer if you use System.out.print(); instead of ptintln(). Using print() will keep the next thing printed on the same line and look like this: 123456. Then you could use commas to separate the numbers like 1,2,3,4.
(needs to be between 10 and 20 numbers)
import java.util.Scanner; import java.util.Random; public class Looper { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Random rnd = new Random(); int r; System.out.println("Please enter enter how many numbers " + "you would like to generate."); int userInput = sc.nextInt(); for(r=1;r<userInput;r++) { // was unsure how to remove the comma from the last number System.out.print((int)(rnd.nextFloat()*100)+1 + ","); } } }