Advertisement
Guest User

Untitled

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