Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String catBreed = scanner.nextLine(),
- catGender = scanner.nextLine();
- int breedYears = switch (catBreed) {
- case "Siberian" -> 11;
- case "American Shorthair" -> 12;
- case "British Shorthair" -> 13;
- case "Persian" -> 14;
- case "Siamese" -> 15;
- case "Ragdoll" -> 16;
- };
- if (catGender.equals("f")) {
- breedYears++;
- }
- if (breedYears > 0) {
- System.out.printf("%d cat months", breedYears * 2);
- } else {
- Scanner.out.printf("%s is invalid cat!", catBreed);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement