Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class HotelRoom {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String month = scanner.nextLine();
- int nights = Integer.parseInt(scanner.nextLine());
- double studioPrice = 0;
- double apartmentPrice= 0;
- if (month.equalsIgnoreCase("may") || month.equalsIgnoreCase("october")) {
- studioPrice = 50;
- apartmentPrice = 65;
- if (nights > 14) {
- studioPrice *= 0.70;
- } else if (nights > 7) {
- studioPrice *= 0.95;
- }
- } else if (month.equalsIgnoreCase("june") || month.equalsIgnoreCase("september")) {
- studioPrice = 75.20;
- apartmentPrice = 68.70;
- if (nights > 14) {
- studioPrice *= 0.80;
- }
- } else if (month.equalsIgnoreCase("july") || month.equalsIgnoreCase("august")) {
- studioPrice = 76;
- apartmentPrice = 77;
- }
- if (nights > 14) {
- apartmentPrice *= 0.90;
- }
- double apartamentTotal = apartmentPrice * nights;
- double studioTotal = studioPrice * nights;
- System.out.printf("Apartment: %.2f lv.%n", apartamentTotal);
- System.out.printf("Studio: %.2f lv.", studioTotal);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement