Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. package sk.stuba.fei.Zadanie2cvikouloha1;
  2. import java.util.Scanner;
  3.  
  4. import static sk.stuba.fei.Zadanie2cvikouloha1.MyDate.isValidDate;
  5.  
  6. public class main {
  7.  
  8. public static void main(String[] args) {
  9. Scanner in = new Scanner(System.in);
  10. System.out.println("Please write the date and last date in format: dd:mm:yyyy");
  11. System.out.println("Day: ");
  12. int day=in.nextInt();
  13. System.out.println("Month: ");
  14. int month=in.nextInt();
  15. System.out.println("Year: ");
  16. int year=in.nextInt();
  17. System.out.println("Last Day: ");
  18. int lastDay=in.nextInt();
  19. System.out.println("Last Month: ");
  20. int lastMonth=in.nextInt();
  21. System.out.println("Last Year: ");
  22. int lastYear=in.nextInt();
  23. in.close();
  24.  
  25. MyDate date = new MyDate(day, month ,year);
  26.  
  27.  
  28. if (isValidDate(day,month,year) == true) {System.out.println("Date: "+ date +" is correct");}
  29. else {System.out.println("Date: "+ date +" is incorrect");}
  30. System.out.println(date.getDayOfWeek(day,month,year));
  31. //System.out.println("Next year of Mydate: ");
  32. //System.out.println(date.nextYear());
  33.  
  34. for (int i=0;i<=5;i++){
  35. System.out.println("Next day of Mydate: ");
  36. System.out.println(date.nextDay(day, month, year));
  37. }
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44. }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement