YavorGrancharov

PersonalTitles

Jan 21st, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class PersonalTitles {
  4.     public static void main(String[] args) {
  5.         Scanner console = new Scanner(System.in);
  6.         double age = Double.parseDouble(console.nextLine());
  7.         String gender = console.nextLine();
  8.  
  9.         if (age < 16 && gender.equals("m")) {
  10.             System.out.println("Master");
  11.         } else if (age >= 16 && gender.equals("m")){
  12.             System.out.println("Mr.");
  13.         }
  14.         if (age < 16 && gender.equals("f")) {
  15.             System.out.println("Miss");
  16.         } else if (age >= 16 && gender.equals("f")){
  17.             System.out.println("Ms.");
  18.         }
  19.     }
  20. }
Add Comment
Please, Sign In to add comment