Advertisement
Guest User

prog

a guest
Nov 17th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  */
  3. package pradas_borrueco_cristian_porg02_tarea;
  4.  
  5. /**
  6.  *
  7.  * @author Noni
  8.  */
  9. public class Ejercicio02 {
  10.     public static void main (String[] m){
  11.         int segAleatorio=(int)Math.round(Math.random()*86400);
  12.         System.out.println("El número de segundos transcurridos son " + segAleatorio);
  13.        
  14.         int hh, mm;
  15.         hh = segAleatorio/3600;
  16.         mm = (segAleatorio-(3600*hh))/60;
  17.         System.out.println("Corresponde con las " + hh + " horas y " + mm + " minutos");
  18.        
  19.         String queToca = "";
  20.  
  21.        
  22.         if (hh<7 || hh==7 && mm < 30 ){
  23.             queToca += "DORMIR.";
  24.         } else if ((hh >7 || hh==7 && mm >=30) && (hh <8 || hh==8 && mm <=30)){
  25.             queToca += "LEVANTARSE Y DESAYUNAR.";
  26.         } else if ((hh >8 || hh==8 && mm >30) && (hh <13 || hh==13 && mm <=30)){
  27.             queToca += "TRABAJAR.";
  28.         } else if (hh <20 || hh <=20 && mm < 30){
  29.             System.out.println("AHORA TOCA " + queToca);
  30.         } else if (hh >20 || hh >=20 && mm >= 30){
  31.             System.out.println("NO TENGO GANAS DE " + queToca);
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement