Advertisement
Ligh7_of_H3av3n

03.CatLife

Oct 21st, 2023
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.38 KB | None | 0 0
  1. package ZadachiOtIzpita2;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class CatLife {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.  
  10.         String catType = scanner.nextLine();
  11.         String genderType = scanner.nextLine();
  12.  
  13.  
  14.  
  15.         double catCount = 0;
  16.         double catInHuman = 0;
  17.         double catMonths = 0;
  18.  
  19.  
  20.         if (catType.equals("British Shorthair")) {
  21.             switch (genderType) {
  22.                 case "m" :
  23.                     catCount = 13;
  24.                     catInHuman = catCount * 12;
  25.                     catMonths = catInHuman / 6;
  26.                     break;
  27.                 case "f":
  28.                     catCount = 14;
  29.                     catInHuman = catCount * 12;
  30.                     catMonths = catInHuman / 6;
  31.                     break;
  32.             }
  33.         } else if (catType.equals("Siamese")) {
  34.             switch (genderType) {
  35.                 case "m" :
  36.                     catCount = 15;
  37.                     catInHuman = catCount * 12;
  38.                     catMonths = catInHuman / 6;
  39.                     break;
  40.                 case "f":
  41.                     catCount = 16;
  42.                     catInHuman = catCount * 12;
  43.                     catMonths = catInHuman / 6;
  44.                     break;
  45.             }
  46.         } else if (catType.equals("Persian")) {
  47.             switch (genderType) {
  48.                 case "m" :
  49.                     catCount = 14;
  50.                     catInHuman = catCount * 12;
  51.                     catMonths = catInHuman / 6;
  52.                     break;
  53.                 case "f":
  54.                     catCount = 15;
  55.                     catInHuman = catCount * 12;
  56.                     catMonths = catInHuman / 6;
  57.                     break;
  58.             }
  59.         } else if (catType.equals("Ragdoll")) {
  60.             switch (genderType) {
  61.                 case "m" :
  62.                     catCount = 16;
  63.                     catInHuman = catCount * 12;
  64.                     catMonths = catInHuman / 6;
  65.                     break;
  66.                 case "f":
  67.                     catCount = 17;
  68.                     catInHuman = catCount * 12;
  69.                     catMonths = catInHuman / 6;
  70.                     break;
  71.             }
  72.         } else if (catType.equals("American Shorthair")) {
  73.             switch (genderType) {
  74.                 case "m" :
  75.                     catCount = 12;
  76.                     catInHuman = catCount * 12;
  77.                     catMonths = catInHuman / 6;
  78.                     break;
  79.                 case "f":
  80.                     catCount = 13;
  81.                     catInHuman = catCount * 12;
  82.                     catMonths = catInHuman / 6;
  83.                     break;
  84.             }
  85.         } else if (catType.equals("Siberian")) {
  86.             switch (genderType) {
  87.                 case "m" :
  88.                     catCount = 11;
  89.                     catInHuman = catCount * 12;
  90.                     catMonths = catInHuman / 6;
  91.                     break;
  92.                 case "f":
  93.                     catCount = 12;
  94.                     catInHuman = catCount * 12;
  95.                     catMonths = catInHuman / 6;
  96.                     break;
  97.             }
  98.         } else {
  99.             System.out.printf("%s is invalid cat!", catType);
  100.             return;
  101.         }
  102.         System.out.printf("%.0f cat months",Math.floor(catMonths));
  103.  
  104.  
  105.     }
  106. }
  107.  
  108.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement