Answer:
import java.lang.Math;
class Main {
public static void main(String[] args) {
int max = 9;
int min = 0;
int loops = 3;
int coin1 = 0;
int coin2 = 0;
for (int i =0; i < loops; i++) {
coin1 = (int) (Math.random() * (max - min + 1) + min);
coin2 = (int) (Math.random() * (max - min + 1) + min);
System.out.println("Coin 1: " + coin1 + ", Coin 2: " + coin2);
// CHALLENGE #1: Change the code below to say WOW if both coins are even
if (coin1 % 2 == 0 && coin2 % 2 == 0) {
System.out.println("WOW! Both coins are even!");
} else {
System.out.println("No matches");
}
// CHALLENGE #2: Change the code below to say WOW if both coins are the same
if (coin1 == coin2) {
System.out.println("WOW! Two coins the same!");
} else {
System.out.println("No matches");
}
// CHALLENGE #3: Change the code below to say WOW if at least 1 coin is heads (1, not 0)
if (coin1 == 1 || coin2 == 1) {
System.out.println("WOW! At least one coin is heads");
} else {
System.out.println("Neither coin is heads");
}
// CHALLENGE #4: Change the code below to say WOW if both coins are heads
if (coin1 == 1 && coin2 == 1) {
System.out.println("WOW! Both coins are heads!");
} else {
System.out.println("No matches");
}
}
}
}
Step-by-step explanation: