Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ProgrammingBasics;
- import java.util.Scanner;
- public class hotelRooms {
- public static void main(String[] args){
- Scanner scanner = new Scanner(System.in);
- String month = scanner.nextLine();
- int numbersOfNights=Integer.parseInt(scanner.nextLine());
- double priceOfApartment=0;
- double priceofStudio=0;
- if(month.equalsIgnoreCase("may")|| month.equalsIgnoreCase("october")){
- if(numbersOfNights>7 && numbersOfNights<14){
- priceofStudio=numbersOfNights*50;
- priceofStudio=priceofStudio-(priceofStudio*0.05);
- priceOfApartment=numbersOfNights*65;
- }else if(numbersOfNights>14){
- priceofStudio=numbersOfNights*50;
- priceOfApartment=numbersOfNights*65;
- priceofStudio=priceofStudio-(priceofStudio*0.30);
- priceOfApartment=priceOfApartment-(priceOfApartment*0.10);
- }else{
- priceofStudio=numbersOfNights*50;
- priceOfApartment=numbersOfNights*65;
- }
- }else if(month.equalsIgnoreCase("june")|| month.equalsIgnoreCase("september")){
- if(numbersOfNights>7 &&numbersOfNights<14){
- priceofStudio=numbersOfNights*75.20;
- priceOfApartment=numbersOfNights*68.7;
- }else if(numbersOfNights>14){
- priceofStudio=numbersOfNights*75.2;
- priceOfApartment=numbersOfNights*68.7;
- priceofStudio=priceofStudio-(priceofStudio*0.20);
- priceOfApartment=priceOfApartment-(priceOfApartment*0.10);
- }else{
- priceofStudio=numbersOfNights*75.20;
- priceOfApartment=numbersOfNights*68.7;
- }
- }else if(month.equalsIgnoreCase("July")|| month.equalsIgnoreCase("August")){
- if(numbersOfNights>14){
- priceOfApartment=numbersOfNights*77;
- priceofStudio=numbersOfNights*76;
- priceOfApartment=priceOfApartment-(priceOfApartment*0.10);
- } else{
- priceOfApartment=numbersOfNights*77;
- priceofStudio=numbersOfNights*76;
- }
- }
- System.out.printf("Apartment:"+" %.2f "+"lv.%n",priceOfApartment);
- System.out.printf("Studio:"+" %.2f "+ "lv.",priceofStudio);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement