Advertisement
Ivelin_1936

Traveling

Feb 27th, 2018
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.79 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.math.BigDecimal;
  4. import java.text.Format;
  5. import java.util.Scanner;
  6.  
  7. public class Main {
  8.  
  9.     public static void main(String[] args) {
  10.         Scanner scanner = new Scanner(System.in);
  11.  
  12.         BigDecimal budget = new BigDecimal(scanner.nextLine());
  13.         String season = scanner.nextLine();
  14.         String destinationResult = "";
  15.         String holidayInformation = "";
  16.         BigDecimal moneySpent = BigDecimal.ZERO;
  17.         if (budget.compareTo(BigDecimal.valueOf(100.00)) <= 0){
  18.             destinationResult = "Bulgaria";
  19.  
  20.  
  21.             if (season.equals("summer")){
  22.                 moneySpent = BigDecimal.valueOf(0.30).multiply(budget);
  23.                 holidayInformation = String.format("Camp - %.2f", moneySpent);
  24.             }else {
  25.                 moneySpent = BigDecimal.valueOf(0.70).multiply(budget);
  26.                 holidayInformation = String.format("Hotel - %.2f", moneySpent);
  27.             }
  28.         }else if (budget.compareTo(BigDecimal.valueOf(1000.00)) <= 0){
  29.             destinationResult = "Balkans";
  30.             if (season.equals("summer")){
  31.                 moneySpent = BigDecimal.valueOf(0.40).multiply(budget);
  32.                 holidayInformation = String.format("Camp - %.2f", moneySpent);
  33.             }else{
  34.                 moneySpent = BigDecimal.valueOf(0.80).multiply(budget);
  35.                 holidayInformation = String.format("Hotel - %.2f", moneySpent);
  36.             }
  37.         }else {
  38.             destinationResult = "Europe";
  39.             moneySpent = BigDecimal.valueOf(0.90).multiply(budget);
  40.             holidayInformation = String.format("Hotel - %.2f", moneySpent);
  41.         }
  42.         System.out.println(String.format("Somewhere in %s",destinationResult));
  43.         System.out.println(holidayInformation);
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement