Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package EXAM;
- import java.util.Scanner;
- public class Reservation_02 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int reservationDay = Integer.parseInt(scanner.nextLine());
- int reservationMonth = Integer.parseInt(scanner.nextLine());
- int checkInDay = Integer.parseInt(scanner.nextLine());
- int checkInMouth = Integer.parseInt(scanner.nextLine());
- int leftDay = Integer.parseInt(scanner.nextLine());
- int leftMouth = Integer.parseInt(scanner.nextLine());
- double price = 0;
- if (reservationMonth < checkInMouth ) {
- price = 25 - 25 * 0.20;
- } else if (checkInDay - reservationDay >= 10) {
- price = 25;
- } else {
- price = 30;
- }
- double days = leftDay - checkInDay;
- double sum = price * days;
- System.out.printf("Your stay from %d/%d to %d/%d will cost %.2f",checkInDay,checkInMouth,leftDay,leftMouth,sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement