Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ZadachiOtIzpita2;
- import java.util.Scanner;
- public class CatLife {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String catType = scanner.nextLine();
- String genderType = scanner.nextLine();
- double catCount = 0;
- double catInHuman = 0;
- double catMonths = 0;
- if (catType.equals("British Shorthair")) {
- switch (genderType) {
- case "m" :
- catCount = 13;
- catInHuman = catCount * 12;
- catMonths = catInHuman / 6;
- break;
- case "f":
- catCount = 14;
- catInHuman = catCount * 12;
- catMonths = catInHuman / 6;
- break;
- }
- } else if (catType.equals("Siamese")) {
- switch (genderType) {
- case "m" :
- catCount = 15;
- catInHuman = catCount * 12;
- catMonths = catInHuman / 6;
- break;
- case "f":
- catCount = 16;
- catInHuman = catCount * 12;
- catMonths = catInHuman / 6;
- break;
- }
- } else if (catType.equals("Persian")) {
- switch (genderType) {
- case "m" :
- catCount = 14;
- catInHuman = catCount * 12;
- catMonths = catInHuman / 6;
- break;
- case "f":
- catCount = 15;
- catInHuman = catCount * 12;
- catMonths = catInHuman / 6;
- break;
- }
- } else if (catType.equals("Ragdoll")) {
- switch (genderType) {
- case "m" :
- catCount = 16;
- catInHuman = catCount * 12;
- catMonths = catInHuman / 6;
- break;
- case "f":
- catCount = 17;
- catInHuman = catCount * 12;
- catMonths = catInHuman / 6;
- break;
- }
- } else if (catType.equals("American Shorthair")) {
- switch (genderType) {
- case "m" :
- catCount = 12;
- catInHuman = catCount * 12;
- catMonths = catInHuman / 6;
- break;
- case "f":
- catCount = 13;
- catInHuman = catCount * 12;
- catMonths = catInHuman / 6;
- break;
- }
- } else if (catType.equals("Siberian")) {
- switch (genderType) {
- case "m" :
- catCount = 11;
- catInHuman = catCount * 12;
- catMonths = catInHuman / 6;
- break;
- case "f":
- catCount = 12;
- catInHuman = catCount * 12;
- catMonths = catInHuman / 6;
- break;
- }
- } else {
- System.out.printf("%s is invalid cat!", catType);
- return;
- }
- System.out.printf("%.0f cat months",Math.floor(catMonths));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement