fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int giorno =24;
  13. int mese = 1;
  14. switch(mese){
  15. case 1:
  16. if (giorno +30>31)
  17. {
  18. giorno = giorno + 30-31;
  19. mese = mese+1;
  20. }
  21. else
  22. giorno = giorno +30;
  23. case 2:
  24. if (mese == 2& giorno+30 > 28)
  25. {
  26. giorno = giorno + 30-28;
  27. mese = mese+1;
  28. }
  29. else
  30. giorno = giorno +27;
  31. case 3:
  32. if (mese == 4& giorno+30 > 30)
  33. if (mese == 7& giorno+30 > 30)
  34. if (mese == 9& giorno+30 > 30)
  35. if (mese == 11& giorno+30 > 30)
  36. {
  37. giorno = giorno + 30-30;
  38. mese = mese+1;
  39. }
  40. else
  41. giorno = giorno +29;
  42. }
  43.  
  44. System.out.println("Il libro dovra' essere restituito entro il "+ giorno +" del " + mese);
  45. }
  46. }
Success #stdin #stdout 0.14s 57376KB
stdin
Standard input is empty
stdout
Il libro dovra' essere restituito entro il 25 del 3