TOPIC

Problemas na apresentação do problema

hwinterkorn asked 2 years ago

Alguém poderia indicar um caminho para corrigir o problema? não encontro os erros:

Scanner in = new Scanner(System.in);

    try{
    System.out.print("Dia ");
    int di = in.nextInt();
     int hi, mi, si;
    hi = in.nextInt();
    mi = in.nextInt();
    si = in.nextInt();

    System.out.printf("%d : %d : %d%n",hi,mi,si);

    int tsi = (di * 86400) + (hi * 3600) + (mi * 60) + si;

    System.out.print("Dia ");
    int df = in.nextInt();

    int hf, mf, sf;
    hf = in.nextInt();

    mf = in.nextInt();

    sf = in.nextInt();

    System.out.printf("%d : %d : %d%n",hf,mf,sf);

    int tsf = (df * 86400) + (hf * 3600) + (mf * 60) + sf;

    int totals = tsf - tsi;

    int dia = totals / 86400;
    int hora = (totals % 86400) / 3600;
    int min = ((totals % 86400) % 3600) / 60;
    int seg = ((totals % 86400) % 3600) % 60;

    System.out.println(dia + " dia(s)");
    System.out.println(hora + " hora(s)");
    System.out.println(min + " minuto(s)");
    System.out.println(seg + " segundo(s)");
    }catch(InputMismatchException  e){

    } 

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.