Advertisement
jwrbg

asd

Apr 14th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.38 KB | None | 0 0
  1. package ProgrammingBasics;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class hotelRooms {
  6.     public static void main(String[] args){
  7.         Scanner scanner = new Scanner(System.in);
  8.         String month = scanner.nextLine();
  9.         int numbersOfNights=Integer.parseInt(scanner.nextLine());
  10.  
  11.         double priceOfApartment=0;
  12.         double priceofStudio=0;
  13.  
  14.         if(month.equalsIgnoreCase("may")|| month.equalsIgnoreCase("october")){
  15.             if(numbersOfNights>7 && numbersOfNights<14){
  16.                 priceofStudio=numbersOfNights*50;
  17.                 priceofStudio=priceofStudio-(priceofStudio*0.05);
  18.                 priceOfApartment=numbersOfNights*65;
  19.  
  20.  
  21.             }else if(numbersOfNights>14){
  22.                 priceofStudio=numbersOfNights*50;
  23.                 priceOfApartment=numbersOfNights*65;
  24.                 priceofStudio=priceofStudio-(priceofStudio*0.30);
  25.                 priceOfApartment=priceOfApartment-(priceOfApartment*0.10);
  26.  
  27.             }else{
  28.                 priceofStudio=numbersOfNights*50;
  29.                 priceOfApartment=numbersOfNights*65;
  30.             }
  31.  
  32.         }else if(month.equalsIgnoreCase("june")|| month.equalsIgnoreCase("september")){
  33.             if(numbersOfNights>7 &&numbersOfNights<14){
  34.                 priceofStudio=numbersOfNights*75.20;
  35.                 priceOfApartment=numbersOfNights*68.7;
  36.  
  37.  
  38.             }else if(numbersOfNights>14){
  39.                 priceofStudio=numbersOfNights*75.2;
  40.                 priceOfApartment=numbersOfNights*68.7;
  41.                 priceofStudio=priceofStudio-(priceofStudio*0.20);
  42.                 priceOfApartment=priceOfApartment-(priceOfApartment*0.10);
  43.  
  44.             }else{
  45.                 priceofStudio=numbersOfNights*75.20;
  46.                 priceOfApartment=numbersOfNights*68.7;
  47.             }
  48.  
  49.         }else if(month.equalsIgnoreCase("July")|| month.equalsIgnoreCase("August")){
  50.             if(numbersOfNights>14){
  51.                 priceOfApartment=numbersOfNights*77;
  52.                 priceofStudio=numbersOfNights*76;
  53.                 priceOfApartment=priceOfApartment-(priceOfApartment*0.10);
  54.             } else{
  55.                 priceOfApartment=numbersOfNights*77;
  56.                 priceofStudio=numbersOfNights*76;
  57.  
  58.             }
  59.  
  60.         }
  61.         System.out.printf("Apartment:"+" %.2f "+"lv.%n",priceOfApartment);
  62.         System.out.printf("Studio:"+" %.2f "+ "lv.",priceofStudio);
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement