Advertisement
Mishakis

NameTitles

Jul 16th, 2017
142
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 Main {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner Scanner = new Scanner(System.in);
  7.  
  8.         double years = Double.parseDouble(Scanner.nextLine());
  9.         String g = Scanner.nextLine();
  10.  
  11.         if(g.equalsIgnoreCase("m")){
  12.             if(years<16){
  13.                 System.out.println("Master");
  14.             }else{
  15.                 System.out.println("Mr.");
  16.             }
  17.         }else if(g.equalsIgnoreCase("f")){
  18.             if(years<16){
  19.                 System.out.println("Miss");
  20.             }else{
  21.                 System.out.println("Ms.");
  22.             }
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement