martinvalchev

Personal Titles

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