Advertisement
Guest User

Untitled

a guest
Dec 11th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. /**
  2. * Created by Kamil on 09.12.2017.
  3. */
  4. public class CheckingDate {
  5. public boolean checkDate(int day, int month, int year){
  6. if((year <2001) || (year >2099))
  7. return false;
  8. if((month < 1 ) || (month > 12 ))
  9. return false;
  10. if((day < 1) || (day > 31))
  11. return false;
  12. if((month == 2 ) && (day > 29))
  13. return false;
  14. if(month == 2 && !(year % 4 == 0 && year % 100 != 0 || year % 400 == 0) && (day >28))
  15. return false;
  16. if((day == 31) && ( month == 4 || month == 6 || month == 9 || month == 11 ))
  17. return false;
  18. return true;
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement