tchenkov

L04u15_Trip

Jan 23rd, 2017
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.55 KB | None | 0 0
  1. package Uprajneniq;
  2.  
  3. import java.util.Scanner;
  4.  
  5. /**
  6.  * Created by todor on 24.01.2017 г..
  7.  */
  8. public class u15_Trip {
  9.     public static void main(String[] args) {
  10.  
  11.         Scanner scan = new Scanner(System.in);
  12.  
  13.         double spendingMoney = Double.parseDouble(scan.nextLine());
  14.         String season = scan.nextLine().toLowerCase();
  15.  
  16.         double tripCost = 0;
  17.  
  18.         if (spendingMoney > 0) {
  19.             System.out.print("Somewhere in ");
  20.             if (spendingMoney <= 100) {
  21.                 System.out.println("Bulgaria");
  22.                 if (season.equals("summer")) {
  23.                     tripCost = spendingMoney * 0.3;
  24.                     System.out.printf("Camp - %.2f", tripCost);
  25.                 } else if (season.equals("winter")) {
  26.                     tripCost = spendingMoney * 0.7;
  27.                     System.out.printf("Hotel - %.2f", tripCost);
  28.                 }
  29.             } else if (spendingMoney > 1000) {
  30.                 tripCost = spendingMoney * 0.9;
  31.                 System.out.println("Europe");
  32.                 System.out.printf("Hotel - %.2f", tripCost);
  33.             } else {
  34.                 System.out.println("Balkans");
  35.                 if (season.equals("summer")) {
  36.                     tripCost = spendingMoney * 0.4;
  37.                     System.out.printf("Camp - %.2f", tripCost);
  38.                 } else if (season.equals("winter")) {
  39.                     tripCost = spendingMoney * 0.8;
  40.                     System.out.printf("Hotel - %.2f", tripCost);
  41.                 }
  42.             }
  43.         }
  44.  
  45.     }
  46. }
Add Comment
Please, Sign In to add comment