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();
- int nights = Integer.parseInt(scanner.nextLine());
- String room = "";
- double price = 0.0;
- if ("May".equals(month) || "October".equals(month)) {
- if (nights > 14) {
- price = nights * 65 * 0.90;
- System.out.printf("Apartment: %.2f lv.", price);
- } else {
- price = nights * 65;
- System.out.printf("Apartment: %.2f lv.", price);
- }
- System.out.println();
- }
- if ("May".equals(month) || "October".equals(month)) {
- if (nights > 7 && nights <= 14) {
- price = nights * 50 * 0.95;
- System.out.printf("Studio: %.2f lv.", price);
- } else if (nights > 14) {
- price = nights * 50 * 0.70;
- System.out.printf("Studio: %.2f lv.", price);
- } else {
- price = nights * 50;
- System.out.printf("Studio: %.2f lv.", price);
- }
- }
- if ("June".equals(month) || "September".equals(month)) {
- if (nights > 14) {
- price = nights * 68.70 * 0.90;
- System.out.printf("Apartment: %.2f lv.", price);
- } else {
- price = nights * 68.70;
- System.out.printf("Apartment: %.2f lv.", price);
- }
- System.out.println();
- }
- if ("June".equals(month) || "September".equals(month)) {
- if (nights > 14) {
- price = 75.20 * nights * 0.80;
- System.out.printf("Studio: %.2f lv.", price);
- } else {
- price = nights * 75.20;
- System.out.printf("Studio: %.2f lv.", price);
- }
- }
- if ("July".equals(month) || "August".equals(month)) {
- if (nights > 14) {
- price = 77 * nights * 0.90;
- System.out.printf("Apartment: %.2f lv.", price);
- } else {
- price = 77 * nights;
- System.out.printf("Apartment: %.2f lv.", price);
- }
- System.out.println();
- }
- if ("July".equals(month) || "August".equals(month)) {
- price = 76 * nights;
- System.out.printf("Studio: %.2f lv.", price);
- }
- }
- }
Add Comment
Please, Sign In to add comment