Create a Java program that will utilize conditional statements to check if a student wishes to join and is qualified to join the limited Face-to-Face classes. There are four (4) requirements in order to join:
SAMPLE OUTPUT 1:
Would you be joining the LF2F classes? Yes
Are you fully vaccinated? Yes
Do you have health insurance that covers COVID cases? Yes
Did your parents allow you to join LF2F classes? Yes
Are you registered with Stay Safe PH? Yes
That's great! You can join the limited Face-to-Face classes!
SAMPLE OUTPUT 2:
Would you be joining the LF2F classes? Yes
Are you fully vaccinated? Yes
Do you have health insurance that covers COVID cases? No
Did your parents allow you to join LF2F classes? No
Are you registered with Stay Safe PH? Yes
We are sorry to inform you that you are not allowed to join the limited Face-to-Face classes.
SAMPLE OUTPUT 3:
Would you be joining the LF2F classes? No
You may answer your laboratory activities at home.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Would you be joining the LF2F classes? ");
boolean join = in.next().equalsIgnoreCase("Yes");
if (!join) {
System.out.println("You may answer your laboratory activities at home.");
return;
}
System.out.print("Are you fully vaccinated? ");
boolean vaccine = in.next().equalsIgnoreCase("Yes");
System.out.print("Do you have health insurance that covers COVID cases? ");
boolean insurance = in.next().equalsIgnoreCase("Yes");
System.out.print("Did your parents allow you to join LF2F classes? ");
boolean allow = in.next().equalsIgnoreCase("Yes");
System.out.print("Are you registered with Stay Safe PH? ");
boolean register = in.next().equalsIgnoreCase("Yes");
if (vaccine && insurance && allow && register) {
System.out.println("That's great! You can join the limited Face-to-Face classes!");
} else if (vaccine && !insurance && !allow && register) {
System.out.println("We are sorry to inform you that you are not allowed to join the limited Face-to-Face classes.");
}
}
}
Comments
Leave a comment