Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Address {
- public static void main (String [] args){
- Scanner keyboard = new Scanner(System.in);
- System.out.print("Enter male or female: ");
- String gender = keyboard.next();
- System.out.print("Enter your age: ");
- int age = keyboard.nextInt();
- if (gender.equals("female")) {
- if (16 <= age && age < 22){
- System.out.printf("You are a girl over 16 years old. You can enter the party%nbut you are not allowed to booze!");
- }else if (16 > age ) {
- System.out.println("You are a girl under 16 years old. You cannot enter the party!");
- }else {
- System.out.printf("You are a woman over 22 years old. You are welcomed in the party%nand you are allowed to booze! ");
- }
- }else if (gender.equals("male")){
- if(16 <= age && age < 22 ){
- System.out.printf("You are a man over 16 but less than 22 years old. You can enter the party%nbut you are not allowed to booze! ");
- }else if (16 > age){
- System.out.println("You are a boy under 16 years old. You cannot enter the party!");
- }else {
- System.out.printf("You ara a man over 22 years old. You ara welcomed the party%nand You are allowed to booze!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement