Deiancom

Reservation

Sep 20th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.00 KB | None | 0 0
  1. package EXAM;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Reservation_02 {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         int reservationDay = Integer.parseInt(scanner.nextLine());
  9.         int reservationMonth = Integer.parseInt(scanner.nextLine());
  10.         int checkInDay = Integer.parseInt(scanner.nextLine());
  11.         int checkInMouth = Integer.parseInt(scanner.nextLine());
  12.         int leftDay = Integer.parseInt(scanner.nextLine());
  13.         int leftMouth = Integer.parseInt(scanner.nextLine());
  14.  
  15.         double price = 0;
  16.         if (reservationMonth < checkInMouth ) {
  17.             price = 25 - 25 * 0.20;
  18.         } else if (checkInDay - reservationDay >= 10) {
  19.             price = 25;
  20.         } else {
  21.             price = 30;
  22.         }
  23.         double days = leftDay - checkInDay;
  24.         double sum = price * days;
  25.         System.out.printf("Your stay from %d/%d to %d/%d will cost %.2f",checkInDay,checkInMouth,leftDay,leftMouth,sum);
  26.     }
  27. }
Add Comment
Please, Sign In to add comment