Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Reservation {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int dayOfReservation = Integer.parseInt(scanner.nextLine());
- int mountOfReservation = Integer.parseInt(scanner.nextLine());
- int dayOfArrive = Integer.parseInt(scanner.nextLine());
- int mountArrive = Integer.parseInt(scanner.nextLine());
- int dayLeaving = Integer.parseInt(scanner.nextLine());
- int mountLeaving = Integer.parseInt(scanner.nextLine());
- int differenceDay = dayOfArrive-dayOfReservation;
- int differenceMount = mountArrive-mountOfReservation;
- if(differenceMount>=1){
- int price = 25;
- double totalPrice = (dayLeaving-dayOfArrive)*price*0.80;
- System.out.printf("Your stay from %d/%d to %d/%d ",dayOfArrive,mountArrive,dayLeaving,mountLeaving);
- System.out.printf("will cost %.2f",totalPrice);
- }else if(differenceDay>=10 && differenceMount == 0){
- int price = 25;
- int totalPrice = (dayLeaving-dayOfArrive)*price;
- System.out.printf("Your stay from %d/%d to %d/%d ",dayOfArrive,mountArrive,dayLeaving,mountLeaving);
- System.out.printf("will cost %.2d",totalPrice);
- }else if(differenceDay<10 && differenceMount == 0){
- int totalPrice = (dayLeaving-dayOfArrive)*30;
- System.out.printf("Your stay from %d/%d to %d/%d ",dayOfArrive,mountArrive,dayLeaving,mountLeaving);
- System.out.printf("will cost %.2d",totalPrice);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement