Advertisement
Guest User

Untitled

a guest
Oct 26th, 2020
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.39 KB | None | 0 0
  1. package ConditionalStatementsAdvanced.MoreExercises;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class SchoolCamp {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         String season = scanner.nextLine();
  10.         String typeGroup = scanner.nextLine();
  11.         int sumStudant = Integer.parseInt(scanner.nextLine());
  12.         int sumNight = Integer.parseInt(scanner.nextLine());
  13.  
  14.         double priceNight = 0;
  15.         double discount = 0;
  16.         String sport = " ";
  17.  
  18.         if (typeGroup.equals("boys")) {
  19.             if (season.equals("Winter")) {
  20.                 priceNight = sumNight * sumStudant * 9.60;
  21.                 sport = "Judo";
  22.             } else if (season.equals("Spring")) {
  23.                 priceNight = sumNight * sumStudant * 7.20;
  24.                 sport = "Tennis";
  25.             } else if (season.equals("Summer")) {
  26.                 priceNight = sumNight * sumStudant * 15;
  27.                 sport = "Football";
  28.             }
  29.         } else if (typeGroup.equals("girls")) {
  30.             if (season.equals("Winter")) {
  31.                 priceNight = sumNight * sumStudant * 9.60;
  32.                 sport = "Gymnastics";
  33.             } else if (season.equals("Spring")) {
  34.                 priceNight = sumNight * sumStudant * 7.20;
  35.                 sport = "Athletics";
  36.             } else if (season.equals("Summer")) {
  37.                 priceNight = sumNight * sumStudant * 15;
  38.                 sport = "Volleyball";
  39.             }
  40.         } else if (typeGroup.equals("mixed")) {
  41.             if (season.equals("Winter")) {
  42.                 priceNight = sumNight * sumStudant * 10;
  43.                 sport = "Ski";
  44.             } else if (season.equals("Spring")) {
  45.                 priceNight = sumNight * sumStudant * 9.50;
  46.                 sport = "Cycling";
  47.             } else if (season.equals("Summer")) {
  48.                 priceNight = sumNight * sumStudant * 20;
  49.                 sport = "Swimming";
  50.             }
  51.  
  52.         }
  53.         if (sumStudant >= 10 && sumStudant < 20) {
  54.             discount = priceNight * 0.05;
  55.         } else if (sumStudant >= 20 && sumStudant < 50) {
  56.             discount = priceNight * 0.15;
  57.         } else if (sumStudant >= 50) {
  58.             discount = priceNight * 0.50;
  59.         }
  60.  
  61.         double totalPriceNight = priceNight - discount;
  62.         System.out.printf("%s %.2f lv.", sport, totalPriceNight);
  63.  
  64.     }
  65. }
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement