This is my first post in the Dani community. I am brand new to java, 5 weeks into an intro to computer programming course. My assignment is to create 10 random numbers between 50 and 100. Then I am supposed to sort them from lowest to highest, find the average and the max and min. I have got all but the sorting down. i have been struggling so much with this class I cant believe I got this much, any help in the right direction would be greatly appreciated.
package tenrandomnumbers;
import java.util.Scanner;
import java.util.Random;
public class TenRandomNumbers {
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] Random;
Random = new int[10];
int count = 0;
double average = 0;
int Max = 0;
int Min = 100;
int sum = 0;
int number = 0;
for (count = 0; count < 10; count++){
number = 50 + (int)(Math.random()*50);
Random[count] = number;
System.out.println(Random[count]);
sum = sum + number;
average = sum/10;
while(Random[count]>Max)
Max=Random[count];
while(Random[count]<Min)
Min=Random[count];
}
System.out.println("The average is: " + average);
System.out.println("The highest number is " + Max);
System.out.println("The lowest number is " + Min);
}
}