Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class PersonalTitles_04 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double age = Double.parseDouble(scanner.nextLine()); //възраст
- String gender = scanner.nextLine(); //пол -> "m" или "f"
- //проверка за пола
- if(gender.equals("m")) {
- //проверка за възраст -> < 16 или >= 16
- if (age < 16) {
- System.out.println("Master");
- } else { //>= 16
- System.out.println("Mr.");
- }
- } else if (gender.equals("f")) {
- //проверка за възраст
- if(age < 16) {
- System.out.println("Miss");
- } else {
- System.out.println("Ms.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement