Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class HotelRoom {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String month = scanner.nextLine(); //May, June, July, August, September или October
- int numberNight = Integer.parseInt(scanner.nextLine());
- double priceStudio = 0;
- double priceApartments = 0;
- if (month.equals("May") || month.equals("October"))
- {
- priceStudio = 50;
- priceApartments = 65;
- if (numberNight > 7 && numberNight <=14)
- {
- priceStudio = priceStudio * 0.95; // 5% намаление
- priceApartments = priceApartments * 1; //10% намаление
- }else if (numberNight > 14)
- {
- priceStudio = priceStudio * 0.70; // 30% намаление
- priceApartments = priceApartments * 0.90; // 10% намаление
- }
- } else if (month.equals("June") || month.equals("September"))
- {
- priceStudio = 75.20;
- priceApartments = 68.70;
- if (numberNight > 14)
- {
- priceStudio = priceStudio * 0.80; // 20% намаление
- priceApartments = priceApartments * 0.90; // 10% намаление
- }
- }else if (month.equals("July") || month.equals("August"))
- {
- priceStudio = 76;
- priceApartments = 77;
- if (numberNight >=14)
- {
- priceApartments = priceApartments * 0.90; // 10% намаление
- }
- }
- double totalSumApartments = numberNight * priceApartments;
- double totalSumStudio = numberNight * priceStudio;
- System.out.printf("Apartment: %.2f lv. %n" , totalSumApartments);
- System.out.printf("Studio: %.2f lv.", totalSumStudio);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment