From cef84de0427ff1033615701828974b98c679a9b1 Mon Sep 17 00:00:00 2001 From: TiagoRG <35657250+TiagoRG@users.noreply.github.com> Date: Mon, 20 Feb 2023 22:33:02 +0000 Subject: [PATCH] POO dates format --- .../out/production/poo/aula02/SecsToHMS.class | Bin 1245 -> 1198 bytes 1ano/2semestre/poo/src/aula02/SecsToHMS.java | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/1ano/2semestre/poo/out/production/poo/aula02/SecsToHMS.class b/1ano/2semestre/poo/out/production/poo/aula02/SecsToHMS.class index 8f6ac3d379820c118e929a8f2e1dc61a6e66d41e..6f8c06b5ff8dec03f4871f2c1846a31975660ba3 100644 GIT binary patch delta 365 zcmXw#%Ps?P6vlu5>0ER=3rd3&3tE>Jy^!L*|l$!IY3%b@L$zTGG9C|r~kpW znPc8!!68G||56om$zhqCU(pVS3Jyg~g>lxoyuPql^>4NB;}ta7jG!o(f@_lHgq5(7 zc|dhT*%b_Ah*1)B`VFkJAz73%6{!TnAJS(EpZcGX>4vK(^ucP!H3GVF^?Ty+l=Y0( zj!Zl^9L9e$otf%%+& zrYvSKq~y3*zB%=hwy)IR;4G>DASyQ)q8a~wbE1~(b>;;Yd@Qo$WX1nT z&X8HK>z?k1=Ni39Ev&U}ojdzsYU2n2?`AE<|(&Ke{8hgw*7rv%(-bUCBS6QqR*twagP4+TjOB2Ac6+PR=ZKz9&Amxg6lM+p$ue8wG^t9lEl!uDlt?P~5A8ZX1^@s6 diff --git a/1ano/2semestre/poo/src/aula02/SecsToHMS.java b/1ano/2semestre/poo/src/aula02/SecsToHMS.java index 20b3aad..d276bd0 100644 --- a/1ano/2semestre/poo/src/aula02/SecsToHMS.java +++ b/1ano/2semestre/poo/src/aula02/SecsToHMS.java @@ -15,10 +15,10 @@ public class SecsToHMS { System.out.println("Introduza os segundos totais: "); int totalSecs = (int) UserInput.getPositiveNumber(sin); int secs = totalSecs % 60; - int mins = Math.round((float) (totalSecs / 60)); - int hours = Math.round((float) (mins / 60)); + int mins = totalSecs / 60; + int hours = mins / 60; mins = mins % 60; - System.out.printf("%d segundos no formato hh:mm:ss : %d:%d:%d\n", totalSecs, hours, mins, secs); + System.out.printf("%d segundos no formato hh:mm:ss : %02d:%02d:%02d\n", totalSecs, hours, mins, secs); sin.close(); }