You are writing a program to generate a random number between 0 and 1, and if it is less than .5, print less than half. You have the following code so far:
import .Math;
class ExamPrep {
public static void main(String[] args){
double result = Math.random();
// LINE 6
}
}
What can you add at LINE 6 to print less than half when the random number is less than .5? Choose 2 correct answers. Each answer represents a complete solution.
A. if result < .5 {
System.out.println("less than half");
}
B. if result < .5 then {
System.out.println("less than half");
}
C. if (result < .5) {
System.out.println("less than half");
}
D. if (result < .5) then {
System.out.println("less than half");
}
E. if (result < .5) System.out.println("less than half");