daily pastebin goal
47%
SHARE
TWEET

Honeymoon

a guest Nov 9th, 2018 104 in 24 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package Izpitni_zadachi;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Honeymoon {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         double budget = Double.parseDouble(scanner.nextLine());
  9.         String city = scanner.nextLine();
  10.         int broinoshtuvki = Integer.parseInt(scanner.nextLine());
  11.         double totalPrice = 0.0;
  12.         if (city.equalsIgnoreCase("Cairo")) {
  13.             if (broinoshtuvki>=1 && broinoshtuvki <= 4) {
  14.                 double spane = broinoshtuvki * (250 * 2);
  15.                  totalPrice=spane+ 600;
  16.                 totalPrice=totalPrice-totalPrice*3/100;
  17.             } else if (broinoshtuvki>=5 && broinoshtuvki <= 9) {
  18.                 double spane = broinoshtuvki * (250 * 2);
  19.                 totalPrice=spane+ 600;
  20.                 totalPrice=totalPrice-totalPrice*5/100;
  21.             } else if (broinoshtuvki>=10 && broinoshtuvki <= 24) {
  22.                 double spane = broinoshtuvki * (250 * 2);
  23.                 totalPrice=spane+ 600;
  24.                 totalPrice=totalPrice-totalPrice*10/100;
  25.             } else if (broinoshtuvki>=25 && broinoshtuvki <= 49) {
  26.                 double spane = broinoshtuvki * (250 * 2);
  27.                 totalPrice=spane+ 600;
  28.                 totalPrice=totalPrice-totalPrice*17/100;
  29.             }
  30.         } if (city.equalsIgnoreCase("Paris")) {
  31.             if (broinoshtuvki>=5 && broinoshtuvki <= 9) {
  32.                 double spane= broinoshtuvki * (150 * 2);
  33.                 totalPrice=spane+ 350;
  34.                 totalPrice=totalPrice-totalPrice*7/100;
  35.             } else if (broinoshtuvki>=10 && broinoshtuvki <= 24) {
  36.                 double spane= broinoshtuvki * (150 * 2);
  37.                 totalPrice=spane+ 350;;
  38.                 totalPrice=totalPrice-totalPrice*12/100;
  39.             } else if (broinoshtuvki>=25 && broinoshtuvki <= 49) {
  40.                 double spane= broinoshtuvki * (150 * 2);
  41.                 totalPrice=spane+ 350;
  42.                 totalPrice=totalPrice-totalPrice*22/100;
  43.             }
  44.  
  45.         } if (city.equalsIgnoreCase("Lima")) {
  46.             if (broinoshtuvki>=25 && broinoshtuvki <= 49) {
  47.                 double spane = broinoshtuvki * (400 * 2);
  48.                 totalPrice=spane+ 850;
  49.                 totalPrice=totalPrice-totalPrice*19/100;
  50.             }
  51.         } if (city.equalsIgnoreCase("New York")) {
  52.             if (broinoshtuvki>=1 && broinoshtuvki <= 4) {
  53.                 double spane = broinoshtuvki * (300 * 2);
  54.                 totalPrice=spane+650;
  55.                 totalPrice=totalPrice-totalPrice*3/100;
  56.             } else if (broinoshtuvki>=5 && broinoshtuvki <= 9) {
  57.                 double spane = broinoshtuvki * (300 * 2);
  58.                 totalPrice=spane+650;
  59.                 totalPrice=totalPrice-totalPrice* 5/100;
  60.             } else if (broinoshtuvki>=10 && broinoshtuvki <= 24) {
  61.                 double spane = broinoshtuvki * (300 * 2);
  62.                 totalPrice=spane+650;
  63.                 totalPrice=totalPrice-totalPrice*12/100;
  64.             } else if (broinoshtuvki>=25 && broinoshtuvki <= 49) {
  65.                 double spane = broinoshtuvki * (300 * 2);
  66.                 totalPrice=spane+650;
  67.                 totalPrice=totalPrice-totalPrice* 19/100;
  68.             }
  69.         }  if (city.equalsIgnoreCase("Tokyo")) {
  70.             if (broinoshtuvki>=10 && broinoshtuvki <= 24) {
  71.                 double spane = broinoshtuvki * (350 * 2);
  72.                 totalPrice=spane+ 700;
  73.                 totalPrice=totalPrice-totalPrice*12/100;
  74.             } else if (broinoshtuvki>=25 && broinoshtuvki <= 49) {
  75.                 double spane = broinoshtuvki * (350 * 2);
  76.                 totalPrice=spane+ 700;
  77.                 totalPrice=totalPrice-totalPrice*17/100;
  78.             }
  79.             else if(broinoshtuvki>50)
  80.             {
  81.                 totalPrice=totalPrice-totalPrice*30/100;
  82.             }
  83.         }
  84.  
  85.         double ostavashtasuma=budget-totalPrice;
  86.         double nedostig=totalPrice-budget;
  87.         if(budget>totalPrice)
  88.         {
  89.             System.out.printf("Yes! You have %.2f leva left.",ostavashtasuma);
  90.         }
  91.         else
  92.         {
  93.             System.out.printf("Not enough money! You need %.2f leva.",nedostig);
  94.         }
  95.     }
  96. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top