borkins

01. Personal Titles

Mar 26th, 2017
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. /**
  2.  * Project: Complex_Conditions - created by borkins on 2017-03-25.
  3.  */
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class _01_PersonalTitles
  8. {
  9.     public static void main(String[] args)
  10.     {
  11.         Scanner console = new Scanner(System.in);
  12.        
  13.         double age = Double.parseDouble(console.nextLine());
  14.         String gender = console.nextLine();
  15.  
  16.         boolean isMale = gender.equalsIgnoreCase("m");
  17.        
  18.         if (age < 16) {
  19.             System.out.println(isMale ? "Master" : "Miss");
  20.         }
  21.         else {
  22.             System.out.println(isMale ? "Mr." : "Ms.");
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment