Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class iftest01 {
- public static void main(String[] args) {
- int age;
- int gender;
- Scanner sc = new Scanner(System.in);
- System.out.print("How old are you?");
- age = sc.nextInt();
- System.out.print("Are you a boy or girl? (Boy=1/Girl=2) ");
- gender = sc.nextInt();
- if (age > 13 && gender==1) {
- System.out.println("Male Adult ticket please.");
- } else {
- if (age < 13 && gender==2){
- System.out.println("Female Children ticket please.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement