This is my first post here, so excuse me if I'm not posting my question in the correct format. I'm trying to make a program that determines whether the score entered is passing (higher than 70.0) or failing (lower than 70.0). The array I'm using needs to be declared as
double[] scores = new double[50];
so that every compartment in the array contains a real number between 0.0 and 100.0 inclusive.
public class Test
{
public static void main(String[] args)
{
double[] scores = new double[50];
for (int i = 0; i < 50; i++)
{
scores[i] = (int)(Math.random() * 5);
System.out.println(scores[i]);
if (scores[i] <= 70)
System.out.println("Pass" + i);
if (scores[i] < 70)
System.out.println("Fail" + i);
}
}
}
When it runs, it prints a jumbled list of numbers and phrases. How can I make my program run cleanly?