import java.util.Scanner;
public class ConditionalPractice {
// Practice with conditionals - if/else statements
public static void main(String[] args) {
// Boolean operators
// AND &&
// OR || - double pipes just above the return key
// Can you use the commuter lanes?
boolean qualify = false, fastrack = false;
int passengers = 0;
Scanner input = new Scanner(System.in);
// Rewrite this code to use one if statement and boolean operators
System.out.println("This program will determine if you can use the express lane.");
System.out.println("Do you have fastrack? Please enter true or false.");
fastrack = input.nextBoolean();
if(fastrack)
{
System.out.println("How many passengers are you carrying (dogs dont' count)");
passengers = input.nextInt();
if (passengers >= 2)
{
System.out.println("Congratulations you may use the express lane.");
}
else // optional
{
System.out.println("Sorry you cannot use the express lane.");
}
// end of the inner if/else statement
}
else
{
System.out.println("Sorry you cannot use the express lane.");
}
// end of the outer if/else statement
System.out.println("Have nice commute. Thanks for using this program...");
}
}