aneliabogeva

Hotel room

Nov 12th, 2020
970
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.18 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.         String month = scanner.nextLine();
  7.         Integer nights = Integer.parseInt(scanner.nextLine());
  8.         double nightsStudio = 0.00;
  9.         double nightsApartment = 0.00;
  10.  
  11.         if((nights-1)>=7 && (nights-1)<14){
  12.             if("May".equals(month) || "October".equals(month)){
  13.                 nightsStudio = nights*(50-(50*0.05));
  14.                 nightsApartment = nights*65;
  15.             }else if("June".equals(month) || "September".equals(month)) {
  16.                 nightsStudio = nights * 75.20;
  17.                 nightsApartment = nights * 68.70;
  18.             }else if("July".equals(month) || "August".equals(month)) {
  19.                 nightsStudio = nights * 76;
  20.                 nightsApartment = nights * 77;
  21.             }
  22.         }else if((nights-1)>= 14) {
  23.             if ("May".equals(month) || "October".equals(month)) {
  24.                 nightsStudio = nights * (50 - (50 * 0.30));
  25.                 nightsApartment = nights * (65 - (65 * 0.10));
  26.             } else if ("June".equals(month) || "September".equals(month)) {
  27.                 nightsStudio = nights * (75.20 - (75.20 * 0.20));
  28.                 nightsApartment = nights * (68.70 - (68.70 * 0.10));
  29.             } else if ("July".equals(month) || "August".equals(month)) {
  30.                 nightsStudio = nights * 76;
  31.                 nightsApartment = nights * (77 - (77 * 0.10));
  32.             }
  33.         }else{
  34.             if ("May".equals(month) || "October".equals(month)) {
  35.                 nightsStudio = nights * 50;
  36.                 nightsApartment = nights * 65;
  37.             } else if ("June".equals(month) || "September".equals(month)) {
  38.                 nightsStudio = nights * 75.20;
  39.                 nightsApartment = nights * 68.70;
  40.             } else if ("July".equals(month) || "August".equals(month)) {
  41.                 nightsStudio = nights * 76;
  42.                 nightsApartment = nights * 77;
  43.             }
  44.         }
  45.  
  46.         System.out.printf("Apartment: %.2f lv.\n", nightsApartment);
  47.         System.out.printf("Studio: %.2f lv.", nightsStudio);
  48.     }
  49. }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment