Question: This is in JAVA The program lets a person into the club if they are between ages 21 and 29 or over 65. If the
This is in JAVA
The program lets a person into the club if they are between ages 21 and 29 or over 65.
If the person is in the age brackets to get into the club AND their age is an even number they get free drinks all night.
I am having trouble figuring out how to write in the free drinks statement.
Here is what I have written so far
public class ClubBizzaro // this is the program class { // here is the main method of the program public static void main(String[] args) { int theAge; System.out.println("Welcome to Club Bizzaro, where you must be between 21 and 29 or over 65 to enter, " + "and where you get free drinks if your age is an even number." + "Please enter your age: "); theAge = InputUtils.GetInt(); System.out.println("Welcome to Club Bizzaro, where you must be between 21 and 29 or over 65 to enter, " + "and where you get free drinks if your age is an even number." + "Please enter your age: "); //if (theAge < 21 ) // System.out.print("You are under 21 and not welcome in Club Bizzaro "); if ( theAge > 21 && theAge < 29 ) // use the && logical AND operator System.out.println(theAge + " Lucky you... you are between 21 and 29. Welcome to Club Bizzaro"); if ( theAge > 29 && theAge < 65 ) // use the && logical AND operator System.out.println(theAge + " Bummer... you are not between 29 and 65. \" + " + " \"You are not welcome in Club Bizzaro\""); if ( theAge > 65 ) // use the && logical AND operator System.out.println(theAge + " Lucky you... you are over 65. Welcome to Club Bizzaro"); else System.out.println(theAge + " Bummer... you are not between 21 and 29 or over 65. " + "You are not welcome in Club Bizzaro"); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
