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
so that every compartment in the array contains a real number between 0.0 and 100.0 inclusive.
When it runs, it prints a jumbled list of numbers and phrases. How can I make my program run cleanly?
Code:
double[] scores = new double[50];
Code:
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);
}
}
}
Comment