Ask Question
27 June, 22:33

Get user input as a boolean and store it in the variable tallEnough. Also, get user input as a boolean and store it in the variable oldEnough. Then, use the two boolean variables to decide whether the user is able to ride the rollercoaster. The only time the user can ride the rollercoaster is if the responses to both answers is true. Use a logical operator to decide whether the user is eligible to ride. Print true or false depending on whether the user can or can't ride the rollercoaster.

+4
Answers (1)
  1. 28 June, 00:43
    0
    I will code in JAVA.

    import java. util. Scanner;

    public class Main {

    public static void main (String[] args) {

    boolean tallEnough;

    boolean oldEnough;

    Scanner input = new Scanner (System. in);

    tallEnough = input. nextBoolean (); / /wait the input for tallEnough

    oldEnough = input. nextBoolean (); / /wait the input for OldEnough

    if (tallEnough && oldEnough) {

    System. out. print (true);

    } else {

    System. out. print (false);

    }

    }

    }

    Explanation:

    First, to accept user inputs you have to import the class Scanner. Then declare both variables before allowing the user to set input values for both boolean variables.

    In the if-else statement checks if both variables are true, then prints true. Another case prints always false.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Get user input as a boolean and store it in the variable tallEnough. Also, get user input as a boolean and store it in the variable ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers