Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. package es.unileon.prg.date;
  2.  
  3. public class MainDate {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. Date today;
  8.  
  9. try {
  10. System.out.println("Dame un dia");
  11. int day = Teclado.readInteger();
  12. System.out.println("Dame un mes");
  13. int month = Teclado.readInteger();
  14. System.out.println("Dame un año");
  15. int year = Teclado.readInteger();
  16.  
  17. today = new Date(day, month, year);
  18.  
  19. System.out.println(today.toString());
  20. System.out.println(today.stringVersionDate()+"\n");
  21. System.out.println("El nombre del mes es: "+ today.printNameOfMonth());
  22. System.out.println("La estacion del año en ese mes es: "+ today.printSeason());
  23. System.out.println("Los meses restantes hasta fin de año son: "+ today.monthsLeft());
  24. System.out.println("Los días restantes del mes son: "+ today.daysLeft());
  25. System.out.println(today.monthsWithSameDays());
  26. System.out.println("Los dias que han pasado desde principio del año son: "+today.numberDaysFromBeginings());
  27. System.out.println("Numero de intentos para acertar la fecha con la fecha random (do/while): "+ today.attemptsRandom());
  28. System.out.println("Numero de intentos para acertar la fecha con la fecha random (while): "+ today.attemptsRandomWhile());
  29. System.out.println("El dia de la semana de ese dia es: "+ today.dayOfTheWeek());
  30.  
  31.  
  32.  
  33.  
  34. } catch (DateException e) {
  35. System.out.println(e.getMessage());
  36. }
  37.  
  38. }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement