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 nights = Integer.parseInt(scanner.nextLine());
- double apartment = 0;
- double studio = 0;
- switch (month){
- case "May":
- case "October":
- apartment = 65.00;
- studio = 50.00;
- break;
- case "June":
- case "September":
- apartment = 68.70;
- studio = 75.20;
- break;
- case "July":
- case "August":
- apartment = 77.00;
- studio = 76.00;
- break;
- }
- if ((month.equals("May") || month.equals("October")) && nights > 14){
- studio = studio - (studio * 0.30);
- } else if ((month.equals("May") || month.equals("October")) && nights > 7){
- studio = studio - (studio * 0.05);
- } else if ((month.equals("June") || month.equals("September")) && nights > 14){
- studio = studio - (studio * 0.20);
- }
- if (nights > 14){
- apartment = apartment - (apartment * 0.10);
- }
- System.out.printf("Apartment: %.2f lv.%n",nights * apartment);
- System.out.printf("Studio: %.2f lv.",nights * studio);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement