EliPerfanova

Hotel Room

Oct 15th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.51 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class HotelRoom {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         String month = scanner.nextLine();
  8.         int nights = Integer.parseInt(scanner.nextLine());
  9.         String room = "";
  10.         double price = 0.0;
  11.  
  12.         if ("May".equals(month) || "October".equals(month)) {
  13.             if (nights > 14) {
  14.                 price = nights * 65 * 0.90;
  15.                 System.out.printf("Apartment: %.2f lv.", price);
  16.             } else  {
  17.                 price = nights * 65;
  18.                 System.out.printf("Apartment: %.2f lv.", price);
  19.             }
  20.             System.out.println();
  21.         }
  22.         if ("May".equals(month) || "October".equals(month)) {
  23.             if (nights > 7 && nights <= 14) {
  24.                 price = nights * 50 * 0.95;
  25.                 System.out.printf("Studio: %.2f lv.", price);
  26.             } else if (nights > 14) {
  27.                 price = nights * 50 * 0.70;
  28.                 System.out.printf("Studio: %.2f lv.", price);
  29.             } else {
  30.                 price = nights * 50;
  31.                 System.out.printf("Studio: %.2f lv.", price);
  32.             }
  33.         }
  34.  
  35.         if ("June".equals(month) || "September".equals(month)) {
  36.             if (nights > 14) {
  37.                 price = nights * 68.70 * 0.90;
  38.                 System.out.printf("Apartment: %.2f lv.", price);
  39.             } else {
  40.                 price = nights * 68.70;
  41.                 System.out.printf("Apartment: %.2f lv.", price);
  42.  
  43.             }
  44.             System.out.println();
  45.         }
  46.         if ("June".equals(month) || "September".equals(month)) {
  47.             if (nights > 14) {
  48.                 price = 75.20 * nights * 0.80;
  49.                 System.out.printf("Studio: %.2f lv.", price);
  50.             } else {
  51.                 price = nights * 75.20;
  52.                 System.out.printf("Studio: %.2f lv.", price);
  53.             }
  54.         }
  55.  
  56.         if ("July".equals(month) || "August".equals(month)) {
  57.             if (nights > 14) {
  58.                 price = 77 * nights * 0.90;
  59.                 System.out.printf("Apartment: %.2f lv.", price);
  60.             } else {
  61.                 price = 77 * nights;
  62.                 System.out.printf("Apartment: %.2f lv.", price);
  63.             }
  64.             System.out.println();
  65.         }
  66.         if ("July".equals(month) || "August".equals(month)) {
  67.             price = 76 * nights;
  68.             System.out.printf("Studio: %.2f lv.", price);
  69.         }
  70.  
  71.  
  72.     }
  73. }
Add Comment
Please, Sign In to add comment