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();
- Integer nights = Integer.parseInt(scanner.nextLine());
- double nightsStudio = 0.00;
- double nightsApartment = 0.00;
- if((nights-1)>=7 && (nights-1)<14){
- if("May".equals(month) || "October".equals(month)){
- nightsStudio = nights*(50-(50*0.05));
- nightsApartment = nights*65;
- }else if("June".equals(month) || "September".equals(month)) {
- nightsStudio = nights * 75.20;
- nightsApartment = nights * 68.70;
- }else if("July".equals(month) || "August".equals(month)) {
- nightsStudio = nights * 76;
- nightsApartment = nights * 77;
- }
- }else if((nights-1)>= 14) {
- if ("May".equals(month) || "October".equals(month)) {
- nightsStudio = nights * (50 - (50 * 0.30));
- nightsApartment = nights * (65 - (65 * 0.10));
- } else if ("June".equals(month) || "September".equals(month)) {
- nightsStudio = nights * (75.20 - (75.20 * 0.20));
- nightsApartment = nights * (68.70 - (68.70 * 0.10));
- } else if ("July".equals(month) || "August".equals(month)) {
- nightsStudio = nights * 76;
- nightsApartment = nights * (77 - (77 * 0.10));
- }
- }else{
- if ("May".equals(month) || "October".equals(month)) {
- nightsStudio = nights * 50;
- nightsApartment = nights * 65;
- } else if ("June".equals(month) || "September".equals(month)) {
- nightsStudio = nights * 75.20;
- nightsApartment = nights * 68.70;
- } else if ("July".equals(month) || "August".equals(month)) {
- nightsStudio = nights * 76;
- nightsApartment = nights * 77;
- }
- }
- System.out.printf("Apartment: %.2f lv.\n", nightsApartment);
- System.out.printf("Studio: %.2f lv.", nightsStudio);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment