Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ru.itsjava;
- import java.util.Scanner;
- public class HomeWork_1_february {
- public static void main(String[] args) {
- Scanner console = new Scanner(System.in);
- System.out.println("Введите возраст будущего защитника родины!");
- int age = console.nextInt();
- HelloSolider(age);
- System.out.print("Введите год: ");
- int year = console.nextInt();
- Calendar(year);
- }
- private static void HelloSolider(int age) {
- if (age < 18) {
- System.out.println("Идешь в кадеты.");
- } else if (age > 27) {
- System.out.println("В тылу ты пригодишься.");
- } else {
- System.out.println("Давай-ка узнаем твою категорию годности!");
- Scanner console = new Scanner(System.in);
- String Categoty = console.nextLine();
- switch (Categoty) {
- case "A":
- CategorySolider(1);
- break;
- case "B":
- CategorySolider(2);
- break;
- case "C":
- CategorySolider(3);
- break;
- case "D":
- CategorySolider(4);
- }
- }
- }
- private static void CategorySolider(int Categoty) {
- if (Categoty == 1) {
- System.out.println("Добро пожаловать в ВДВ!");
- } else if (Categoty == 2) {
- System.out.println("Добро пожаловать в МорФлот!");
- } else if (Categoty == 3) {
- System.out.println("Добро пожаловать в МотоПехоту!");
- } else if (Categoty == 4) {
- System.out.println("Добро пожаловать в роту снабжения, солдат.");
- }
- }
- private static void Calendar(int year) {
- if ((year % 4 == 0) && ((year % 400 == 0) || (year % 100 != 0))){
- System.out.println("Год " + year + " високосный.");
- } else{
- System.out.println("Год " + year + " не високосный.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement