Advertisement
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 days = Integer.parseInt(scanner.nextLine());
- double priceS;
- double priceA;
- double wholePs;
- double wholePa;
- if (month.equals("May") || month.equals("October"))
- {
- priceS = 50;
- priceA = 65;
- if (days > 7 && days < 14) //// не >=, а >
- {
- priceS = priceS - (priceS * 5 / 100);
- wholePs = priceS * days;
- wholePa = priceA * days;
- System.out.printf("Apartment: %.2f lv." + "\r\n", wholePa);
- System.out.printf("Studio: %.2f lv." + "\r\n", wholePs);
- }
- else if (days >= 14)
- {
- priceS = priceS - (priceS * 30 / 100);
- priceA = priceA - (priceA * 10 / 100);
- wholePs = priceS * days;
- wholePa = priceA * days;
- System.out.printf("Apartment: %.2f lv." + "\r\n", wholePa);
- System.out.printf("Studio: %.2f lv." + "\r\n", wholePs);
- }
- else
- {
- wholePs = priceS * days;
- wholePa = priceA * days;
- System.out.printf("Apartment: %.2f lv." + "\r\n", wholePa);
- System.out.printf("Studio: %.2f lv." + "\r\n", wholePs);
- }
- }
- if (month.equals("June") || month.equals("September"))
- {
- priceS = 75.20;
- priceA = 68.70;
- if (days > 14) ///// повече от 14!!!!!!!!!
- {
- priceS = priceS - (priceS * 20 / 100);
- priceA = priceA - (priceA * 10 / 100);
- wholePs = priceS * days;
- wholePa = priceA * days;
- System.out.printf("Apartment: %.2f lv." + "\r\n", wholePa);
- System.out.printf("Studio: %.2f lv." + "\r\n", wholePs);
- }
- else
- {
- wholePs = priceS * days;
- wholePa = priceA * days;
- System.out.printf("Apartment: %.2f lv." + "\r\n", wholePa);
- System.out.printf("Studio: %.2f lv." + "\r\n", wholePs);
- }
- }
- if (month.equals("July") || month.equals("August"))
- {
- priceS = 76;
- priceA = 77;
- if (days > 14) /// повече от 14
- {
- priceA = priceA - (priceA * 10 / 100);
- wholePs = priceS * days;
- wholePa = priceA * days;
- System.out.printf("Apartment: %.2f lv." + "\r\n", wholePa);
- System.out.printf("Studio: %.2f lv." + "\r\n", wholePs);
- }
- else
- {
- wholePs = priceS * days;
- wholePa = priceA * days;
- System.out.printf("Apartment: %.2f lv." + "\r\n", wholePa);
- System.out.printf("Studio: %.2f lv." + "\r\n", wholePs);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement