Advertisement
damesova

Fishing Boat [Mimi]

Mar 1st, 2019
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.09 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class FishingBoat {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int budget = Integer.parseInt(scanner.nextLine());
  8.         String season = scanner.nextLine();
  9.         int countFisher = Integer.parseInt(scanner.nextLine());
  10.  
  11.         double price = 0;
  12.  
  13.         if (season.equals("Spring")) {
  14.             if (countFisher <= 6) {
  15.                 price = 3000 - 3000 * 0.1;
  16.             } else if (countFisher <= 11) {
  17.                 price = 3000 - 3000 * 0.15;
  18.             } else {
  19.                 price = 3000 - 3000 * 0.25;
  20.             }
  21.             if (countFisher % 2 == 0) {
  22.                 price = price - price * 0.05;
  23.             }
  24.         } else if (season.equals("Summer")) {
  25.             if (countFisher <= 6) {
  26.                 price = 4200 - 4200 * 0.1;
  27.             } else if (countFisher <= 11) {
  28.                 price = 4200 - 4200 * 0.15;
  29.             } else {
  30.                 price = 4200 - 4200 * 0.25;
  31.             }
  32.             if (countFisher % 2 == 0) {
  33.                 price = price - price * 0.05;
  34.             }
  35.         }else if (season.equals("Autumn")) {
  36.                 if (countFisher <= 6) {
  37.                     price = 4200 - 4200 * 0.1;
  38.                 } else if (countFisher <= 11) {
  39.                     price = 4200 - 4200 * 0.15;
  40.                 } else {
  41.                     price = 4200 - 4200 * 0.25;
  42.                 }
  43.         } else {
  44.             if (countFisher <= 6) {
  45.                 price = 2600 - 2600 * 0.1;
  46.             } else if (countFisher <= 11) {
  47.                 price = 2600 - 2600 * 0.15;
  48.             } else {
  49.                 price = 2600 - 2600 * 0.25;
  50.             }
  51.             if (countFisher % 2 == 0) {
  52.                 price = price - price * 0.05;
  53.             }
  54.         }
  55.  
  56.         if (budget >= price) {
  57.             System.out.printf("Yes! You have %.2f leva left.", budget-price);
  58.         } else {
  59.             System.out.printf("Not enough money! You need %.2f leva.",
  60.                     Math.abs(budget-price));
  61.         }
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement