Advertisement
Stani_slava

PersonalTitles

Feb 23rd, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class PersonalTitles {
  4.     public static void main(String[] args) {
  5.          Scanner scanner = new Scanner(System.in);
  6.          char sex = scanner.nextLine().charAt(0);
  7.          double age = Double.parseDouble(scanner.nextLine());
  8.  
  9.          if(sex == 'f'){
  10.              if(age < 16){
  11.                  System.out.println("Miss");
  12.              } else {
  13.                  System.out.println("Ms.");
  14.              }
  15.          } else {
  16.              if(age < 16){
  17.                  System.out.println("Master");
  18.              } else {
  19.                  System.out.println("Mr.");
  20.              }
  21.          }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement