Mirineo

DaysAfterBirth

Oct 22nd, 2016
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. import java.time.LocalDate;
  2. import java.time.format.DateTimeFormatter;
  3. import java.util.Scanner;
  4. public class DateAfterBirth {
  5. public static void main(String[] args) {
  6. Scanner console = new Scanner(System.in);
  7. DateTimeFormatter df = DateTimeFormatter.ofPattern("dd-MM-yyyy");
  8. try {
  9. LocalDate date = LocalDate.parse(console.nextLine(), df);
  10. System.out.println(df.format(date.plusDays(999)));
  11. } catch (Exception e) {
  12. System.out.println("You are an idiot");
  13. }
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment