Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class PersonalTitles {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- char sex = scanner.nextLine().charAt(0);
- double age = Double.parseDouble(scanner.nextLine());
- if(sex == 'f'){
- if(age < 16){
- System.out.println("Miss");
- } else {
- System.out.println("Ms.");
- }
- } else {
- if(age < 16){
- System.out.println("Master");
- } else {
- System.out.println("Mr.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement