-
Notifications
You must be signed in to change notification settings - Fork 6
/
Solution.java
35 lines (30 loc) · 1.12 KB
/
Solution.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
* DeveloperName(): Jignesh Chudasama
*/
import java.util.Scanner;
import java.time.LocalDate;
public class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
LocalDate returnDate = readDate(scan);
LocalDate expectDate = readDate(scan);
scan.close();
int fine;
if (returnDate.isEqual(expectDate) || returnDate.isBefore(expectDate)) {
fine = 0;
} else if (returnDate.getMonth() == expectDate.getMonth() && returnDate.getYear() == expectDate.getYear()) {
fine = 15 * (returnDate.getDayOfMonth() - expectDate.getDayOfMonth());
} else if (returnDate.getYear() == expectDate.getYear()) {
fine = 500 * (returnDate.getMonthValue() - expectDate.getMonthValue());
} else {
fine = 10000;
}
System.out.println(fine);
}
private static LocalDate readDate(Scanner scan) {
int day = scan.nextInt();
int month = scan.nextInt();
int year = scan.nextInt();
return LocalDate.of(year, month, day);
}
}