Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- */
- package pradas_borrueco_cristian_porg02_tarea;
- /**
- *
- * @author Noni
- */
- public class Ejercicio02 {
- public static void main (String[] m){
- int segAleatorio=(int)Math.round(Math.random()*86400);
- System.out.println("El número de segundos transcurridos son " + segAleatorio);
- int hh, mm;
- hh = segAleatorio/3600;
- mm = (segAleatorio-(3600*hh))/60;
- System.out.println("Corresponde con las " + hh + " horas y " + mm + " minutos");
- String queToca = "";
- if (hh<7 || hh==7 && mm < 30 ){
- queToca += "DORMIR.";
- } else if ((hh >7 || hh==7 && mm >=30) && (hh <8 || hh==8 && mm <=30)){
- queToca += "LEVANTARSE Y DESAYUNAR.";
- } else if ((hh >8 || hh==8 && mm >30) && (hh <13 || hh==13 && mm <=30)){
- queToca += "TRABAJAR.";
- } else if (hh <20 || hh <=20 && mm < 30){
- System.out.println("AHORA TOCA " + queToca);
- } else if (hh >20 || hh >=20 && mm >= 30){
- System.out.println("NO TENGO GANAS DE " + queToca);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement