Advertisement
mswi12

Travelling

Sep 9th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.66 KB | None | 0 0
  1. //18. *Пътешествие Трета задача от изпита на 26 март 2016.
  2. import java.util.Scanner;
  3. public class Travelling {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         double budget = Double.parseDouble(scanner.nextLine());
  7.         String season = scanner.nextLine();
  8.         String bulgaria = "Bulgaria";
  9.         String balkans = "Balkans";
  10.         String europe = "Europe";
  11.         String destination = europe;
  12.         String typeHolidays  = "Hotel";
  13.         double money = 0.0;
  14.  
  15.  
  16.         if (budget <= 100) {
  17.             destination = bulgaria;
  18.         } else if (budget <= 1000) {
  19.             destination = balkans;
  20.         }
  21.  
  22.  
  23.             if (season.equals("summer") && destination != europe){
  24.             typeHolidays = "Camp";
  25.             }
  26.  
  27.             if (destination == europe) {
  28.                     money = (budget * 90) /100;
  29.                     } else if(destination == balkans ){
  30.                         if (season.equals("summer")){
  31.                             money = (budget * 40) /100;
  32.                         } else {
  33.                             money = (budget * 80) /100;
  34.                             }
  35.                     } else if (destination == bulgaria){
  36.                          if (season.equals("summer")){
  37.                              money = (budget * 30) /100;
  38.                          } else {
  39.                              money = (budget * 70) /100;
  40.                          }
  41.                     }
  42.  
  43.  
  44.         System.out.printf("Somewhere in %s %n", destination);
  45.         System.out.printf("%s - %.2f", typeHolidays, money);
  46.  
  47.  
  48.  
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement