Advertisement
Firal

HomeWork_1_february

Feb 13th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.26 KB | None | 0 0
  1. package ru.itsjava;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class HomeWork_1_february {
  6.     public static void main(String[] args) {
  7.         Scanner console = new Scanner(System.in);
  8.         System.out.println("Введите возраст будущего защитника родины!");
  9.         int age = console.nextInt();
  10.         HelloSolider(age);
  11.         System.out.print("Введите год: ");
  12.         int year = console.nextInt();
  13.         Calendar(year);
  14.     }
  15.  
  16.     private static void HelloSolider(int age) {
  17.         if (age < 18) {
  18.             System.out.println("Идешь в кадеты.");
  19.         } else if (age > 27) {
  20.             System.out.println("В тылу ты пригодишься.");
  21.         } else {
  22.             System.out.println("Давай-ка узнаем твою категорию годности!");
  23.             Scanner console = new Scanner(System.in);
  24.             String Categoty = console.nextLine();
  25.             switch (Categoty) {
  26.                 case "A":
  27.                     CategorySolider(1);
  28.                     break;
  29.                 case "B":
  30.                     CategorySolider(2);
  31.                     break;
  32.                 case "C":
  33.                     CategorySolider(3);
  34.                     break;
  35.                 case "D":
  36.                     CategorySolider(4);
  37.             }
  38.         }
  39.     }
  40.  
  41.     private static void CategorySolider(int Categoty) {
  42.         if (Categoty == 1) {
  43.             System.out.println("Добро пожаловать в ВДВ!");
  44.         } else if (Categoty == 2) {
  45.             System.out.println("Добро пожаловать в МорФлот!");
  46.         } else if (Categoty == 3) {
  47.             System.out.println("Добро пожаловать в МотоПехоту!");
  48.         } else if (Categoty == 4) {
  49.             System.out.println("Добро пожаловать в роту снабжения, солдат.");
  50.         }
  51.     }
  52.  
  53.     private static void Calendar(int year) {
  54.         if ((year % 4 == 0) && ((year % 400 == 0) || (year % 100 != 0))){
  55.             System.out.println("Год " + year + " високосный.");
  56.         } else{
  57.             System.out.println("Год " + year + " не високосный.");
  58.         }
  59.  
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement