From 21e5176c03c2d60b8de12197ac94c2b980cc5dcc Mon Sep 17 00:00:00 2001 From: TiagoRG <35657250+TiagoRG@users.noreply.github.com> Date: Mon, 20 Feb 2023 10:14:11 +0000 Subject: [PATCH] Floats reformat --- .../production/poo/aula02/AverageSpeed.class | Bin 1193 -> 1221 bytes .../poo/aula02/CelciusToFahrenheit.class | Bin 1035 -> 1065 bytes .../out/production/poo/aula02/Countdown.class | Bin 1340 -> 1366 bytes .../poo/aula02/DistanceBetweenPoints.class | Bin 1440 -> 1465 bytes .../poo/aula02/EnergyToHeatWater.class | Bin 1376 -> 1410 bytes .../production/poo/aula02/Investment.class | Bin 1240 -> 1268 bytes .../out/production/poo/aula02/KmToMiles.class | Bin 1030 -> 1060 bytes .../poo/aula02/PythagoreanTheorem.class | Bin 1455 -> 1376 bytes .../poo/out/production/poo/aula02/README.md | 9 +++++++++ .../production/poo/aula02/RealNumbers.class | Bin 1363 -> 1389 bytes .../out/production/poo/utils/UserInput.class | Bin 697 -> 1039 bytes .../poo/src/aula02/AverageSpeed.java | 4 +++- .../poo/src/aula02/CelciusToFahrenheit.java | 4 +++- 1ano/2semestre/poo/src/aula02/Countdown.java | 4 ++++ .../poo/src/aula02/DistanceBetweenPoints.java | 12 +++++++----- .../poo/src/aula02/EnergyToHeatWater.java | 4 +++- 1ano/2semestre/poo/src/aula02/Investment.java | 4 +++- 1ano/2semestre/poo/src/aula02/KmToMiles.java | 4 +++- .../poo/src/aula02/PythagoreanTheorem.java | 7 +++---- .../2semestre/poo/src/aula02/RealNumbers.java | 2 ++ 1ano/2semestre/poo/src/aula02/SecsToHMS.java | 2 ++ 21 files changed, 42 insertions(+), 14 deletions(-) diff --git a/1ano/2semestre/poo/out/production/poo/aula02/AverageSpeed.class b/1ano/2semestre/poo/out/production/poo/aula02/AverageSpeed.class index b8aff85ac7d77438386396f586c718d353a153de..c4eab1f640f88d994eedc03a1b83f825b71852da 100644 GIT binary patch delta 278 zcmYL@J4*vm5QV?FZZ_FjN*aWk{{ZFTi@_w8>TT?wh}6YMyA_) ze7en2GxGk~<^7%ex~}5nMJNHGa9h8Us;OpH-muYhTo?Y1AxA@){0V4kF+}XJtB%YT zNRg=5_pdYe^Q&XZ{|RO0{9;hLDeyo#&FSbuY1w06b(Ss%94aa0iX+-OY?+Q;n}AJf Y9E*iguW=%lU3N7#k8}R#pXnKn3iKjR^@Ii98I=t@aTpw}MzmMdLFG zads^%?#!G!Gbd*oFXQBU|M>;n@=_%WV~%ZUj_lf$ZpfvbIlD=YBOjr`ClGctwZ%s4 zpRF)eV;92OhKMU+`WN7u8%;4?ditr$KT4$Hx!t%Q2mkGJQd@ZK_pIp;3G0kbyA!vV pa?gV{9P&z^fetzmKI(Z~knH9WV3!5QMTg{hx`4qa^tdi13P;jL`-d kqnWU=LNrJ*U?|Q~WyDyWIm+@(^8g z)@tXASfB$r$;|)HnVs3}OYj{8AMNK?V1v_EaBBtv9AgQ_=`lnuuC8w`9mVj$eEJo~ zT6k_7$*q8GYL0q>VRpineUI%LtO=s*g?C=sKQ!dSADj0a$Kjh-N)@oGK&Vi9gcFZ` zx?GafSy1PsFwvbOOfju3#tgF^tL85}d~rQ&`qlg56QeC{9-V|CqQV$)eJN#R=w*;T zmc>;mHTt{h1tsJdq0F34DvNn4;<%g(EUGD^ye0j$QjpVclXEy@&K%i4-Q0JqI98=# hC29OsxyQQfR!>+JCpB#(F^1Pf?(W;*ANQ4M^=J}8(j(R z#A~>B5q#ZJ@ZLXte^q_E7w0|(&#yp}%f7oep=H`Xny;v4Y51GqxX^U8Xj}I3OtA0Y zg7@s9Auuk(v403hqccOr{{)q^rDG^7EMFPYonG(y?v`<;2(%xmAw^m`qij)b# zt0KpkWQk=_+QAAnd5$`(tm)389#~g5VBHU*Qgg#%jlOItSvG&kh}#kou+5IVplDaz QL83>TsOFTPa?S;%Ke7KQwg3PC diff --git a/1ano/2semestre/poo/out/production/poo/aula02/DistanceBetweenPoints.class b/1ano/2semestre/poo/out/production/poo/aula02/DistanceBetweenPoints.class index 234bebcc128e7347ed9f4a32a456ad671649e85a..122f743f5cfc5a0859fe262978d00bbfde25584e 100644 GIT binary patch delta 644 zcmZXQ%T7~K6o$Wjdg!6;L9iectV#t5rG+CG#aa>6ih$*!6%jQgwN|XDMcd-EzCv^2 zh>1g|GJtx00OKnVAHcDRBjf6+#(~+%zt;ZO?O*G)@14*4<=6Yqz%=)(-Z!ph+N%en zl_PW-beRO`R0?3cd8aD6;gyL^$EW%cRLUV%3kmdR!51-uwsGnvCJYiIIXrL4h%B53cpg7yQ~ zkIFonoDV@sz%6)PewJ7zwrOY|_0|a|1?yq(uqbFY5?Er{;a0dIOuhJ<%yf&*eZW}X z#j{UqGUE5w=XCdlYR;3)(6WgjV{n1XO&XSRN`MQUz;AjRAv+JZfW{F?6QE z^9M|vIF-a&H5x|_{1g5F$4(9VHV&Muv-iqc`|NejC;yG_{rvm+8!$h7T&yja2XwFbHzf{Q|=d8;)&3PtF z-s(?|b5V1N%QEumPF+Si=~AZD$)sY~7;DI1_sDTgGsSiD!y4@DWm+@Ctnux+kjo84 z(tNj*=7s$yI)^2J5tPLV3EniXocQi7;erlHFfXXvbq5P9N*CrfOMzDE-=YY~x$_0L zvQPLUUGw`yBJn0YBTY_32AT{m1kCCGnZ>L<+9I24y~I%V!krj+2l0U<51Pl;_ATa0m5xsM})ipVV<8~}c6TY~@q diff --git a/1ano/2semestre/poo/out/production/poo/aula02/EnergyToHeatWater.class b/1ano/2semestre/poo/out/production/poo/aula02/EnergyToHeatWater.class index 469b9997abf032beaa3ac1d9f64b4c54cbada416..858177db34133faf36a540f499febac224c56145 100644 GIT binary patch delta 332 zcmYLDJ5Iwu6dYTQ19lpUpp@GLBtYg{@v(vM4}>5(ps~WniXb?#l?!kMpCE982nnPV z6u9FQ6jU^Hl!#e_gjSk)pP704X5HG>>-X>(fQOTT^{Lg)>we@5zuS`y8Huv9*t`nF zr4(sD==rKBI}6R1VMTP5?ys28rNYg z^Kc*D^*QZg4LWaw$Q4YY$8MIak#kc|&<5Fhov7BpC^m?NUja5z$!1&F=0uslc+Db5 zNyli9O+RA!Kf!^Wd>E6bMRYNq<+x0x7CYD_+X%3SeI}J~h67aju?ZaVRbgNWE{<54 Qbk3v3YJ|#T`gGKP02Kc|2><{9 delta 258 zcmZqTe!#_b>ff$?3=9nR41OEA-ZN?k2P76HDkK(`rY5HrDX6Aprz@nSDjZ&zUYZDE zsHPp-<*ZNuQlmOqi%EL2JJTX&b_VOs|CkIIg{>HvfJQL@Nk#@%1~wpRGue?v%-9wv z2I4U=a5C5dNggnp6=^Z38WUte#gMhzy+l9CU>#q@@@pOm>591wHUZ2bFixW zi-7gp0Zjv{VQ^+}0n*$I$qcRxZa@DX3oqxXTJR(KluE6c>}h%?gzi#?0nNE?YPsmw|DpL*e21#`;+ZN zc41{ToimTq0Y!E~suVo(H*q(KitIhV8sn9AF)~7^6$Rmb`ZYAORuktY@Tm*Ktj}}6 zVa6SC>~7V6Fsy>}w32J|mIiG1H5r`4qSP>=3Mny4nK3Nm;wRW(l7`q8Q(3~g^5w#b hSf{CTN>dqSHaXLkk!o4{7CC7vT&Qy&Uh3L#^$(H(C(i%? delta 243 zcmeyud4rSd)W2Q(7#JAr8G<)*{brPu_g5%R%t^^tNXyJi%uy&#EjqkVAthBob+Q7} zY-V-_$ITa*m>6Rm7?^;X7=R=r11kd?kaPm_^no-ZkY?4|&cL`4EbR;=LDCEioD42N zk_V!I!Ii-cEauMO0Tcmg-owBFgbWORll549c@esm7&s>Pu*ka#f%TgJtploI@MQ1; v(%cNr4BiYrKocYw%ou!u;!F%`3>pmnKo$#w1%ntv0FVW;KM<&zi6IC8m$D+} diff --git a/1ano/2semestre/poo/out/production/poo/aula02/KmToMiles.class b/1ano/2semestre/poo/out/production/poo/aula02/KmToMiles.class index 0bdc5deb5e7dc8bf6c388d03929c587a539a0ca5..0d2e8cc775c4ae7cbb33bdfc1c1d129d9111490c 100644 GIT binary patch delta 264 zcmYL@J5B;&6otQkfMFa52~0?+01Fd>K@)i?2r4LUf{vhtLo6uV0fp_9G!|@tMiUDc zz)Dz!;mlaroO|zi8vG zBzn)MpIrPml%&BSj`BVkiX2fUtB#!B&&SO*l2Mw0804yJzf*USDnmwkwahX1+LB@) Iff$?3=9nR3@#hF${9KNRnxL_6>Jq$C-*VVW@cwFo@~eTBF2b;38;nv zNHQ|8GOz(j6Ch6?NHYRyR;}#}j2pqyra%%T&A`CPUB? z4D3La3=B4to0zS65xS)q*e0K27Pl4v>(^pn0jXiI24V&VVFpbGTLwFz2@(t{Kqor@ V9VE{n%isuPu>eJ#fNGc+oB?wN89V?0 diff --git a/1ano/2semestre/poo/out/production/poo/aula02/PythagoreanTheorem.class b/1ano/2semestre/poo/out/production/poo/aula02/PythagoreanTheorem.class index 619c22438a060f3e94cebd3329810e0ff8cb9ffb..bf8e1f6e4ceac03a598a54e303571b01e2f2b13d 100644 GIT binary patch delta 349 zcmYL@J5K^p5QV?J>@IlO#Dt((W1&)5V1fo?45Hv$d_Pceg~kv~j1LNb%56;i5sC#8 z6D=(L0~R*^0xN5Ez{295bLO6zIddER(E9cJ@fpZdsp~JxIx;_2ze=S|pPGoJ(kCx> znn|X@9aQMCjdg+9Q<$N>(E%F0SB; zRKvoSu#d>R^*C`DqP*N}v|LG&goW+aw)l>@3cBEfcvX z7RxwKs37FKO|r$n_9HEBFjE?8u<)OiM4JJpw;Y$WZcg#Jpr@UjlRIQP+w2HOsZwND hvVHd1lcyM@KuMHMmQfBwxiXm`5EYTmLzz>Qe*v%IHYWf8 delta 432 zcmYLFO)mpc6g_WdI<40UNmESOu+U(kNkwE7RZ3gbM_a12r8H<%M@+lmZ@j-Dp%yd} zB$j>!TWf3FR>bC>bMLwD+(*Lyc;PVNqO3QPqxR z29L?8J?6)6j0=av8QqNEumI zZ4Cq(2qiO$uKn>lMAH9rN8l76O0U(45V{aWH&XE60zIuw5;TvdQEh|J2@{)0(=Iyp qv4sqs<|S>Ln1TTP>JBlLoD5`%ImpkC95GH^UgU{2Z`&m=341?X-AOk9 diff --git a/1ano/2semestre/poo/out/production/poo/aula02/README.md b/1ano/2semestre/poo/out/production/poo/aula02/README.md index 4a3635a..de42a52 100755 --- a/1ano/2semestre/poo/out/production/poo/aula02/README.md +++ b/1ano/2semestre/poo/out/production/poo/aula02/README.md @@ -5,5 +5,14 @@ * [Guião](https://github.com/TiagoRG/uaveiro-leci/tree/master/1ano/2semestre/poo/guides/POO-2021-aula02.pdf) * [Slides](https://github.com/TiagoRG/uaveiro-leci/tree/master/1ano/2semestre/poo/slides/POO_02_ControloFluxo.pdf) +### Exercise List +| Exercise Number | File Name | Exercise Number | File Name | +|-----------------|----------------------------------------------------------------------------------------------------------------------------------------|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------| +| 1 | [KmToMiles.java](https://github.com/TiagoRG/uaveiro-leci/blob/master/1ano/2semestre/poo/src/aula02/KmToMiles.java) | 6 | [SecsToHMS.java](https://github.com/TiagoRG/uaveiro-leci/blob/master/1ano/2semestre/poo/src/aula02/SecsToHMS.java) | +| 2 | [CelciusToFahrenheit.java](https://github.com/TiagoRG/uaveiro-leci/blob/master/1ano/2semestre/poo/src/aula02/CelciusToFahrenheit.java) | 7 | [DistanceBetweenPoints.java](https://github.com/TiagoRG/uaveiro-leci/blob/master/1ano/2semestre/poo/src/aula02/DistanceBetweenPoints.java) | +| 3 | [EnergyToHeatWater.java](https://github.com/TiagoRG/uaveiro-leci/blob/master/1ano/2semestre/poo/src/aula02/EnergyToHeatWater.java) | 8 | [PythagoreanTheorem.java](https://github.com/TiagoRG/uaveiro-leci/blob/master/1ano/2semestre/poo/src/aula02/PythagoreanTheorem.java) | +| 4 | [Investment.java](https://github.com/TiagoRG/uaveiro-leci/blob/master/1ano/2semestre/poo/src/aula02/Investment.java) | 9 | [Countdown.java](https://github.com/TiagoRG/uaveiro-leci/blob/master/1ano/2semestre/poo/src/aula02/Countdown.java) | +| 5 | [AverageSpeed.java](https://github.com/TiagoRG/uaveiro-leci/blob/master/1ano/2semestre/poo/src/aula02/AverageSpeed.java) | 10 | [RealNumbers.java](https://github.com/TiagoRG/uaveiro-leci/blob/master/1ano/2semestre/poo/src/aula02/RealNumbers.java) | + --- *Pode conter erros, caso encontre algum, crie um* [*ticket*](https://github.com/TiagoRG/uaveiro-leci/issues/new) diff --git a/1ano/2semestre/poo/out/production/poo/aula02/RealNumbers.class b/1ano/2semestre/poo/out/production/poo/aula02/RealNumbers.class index 6460fb1e67fc94e48bd5d5eee967fec73297e6d5..e2a559102e8f05e041cce55ddfd81eda740232c4 100644 GIT binary patch delta 310 zcmXAjyDo%L6otR@AO9S4&P+r?BbfwKxg-krJL7I#lBp#MQJEn^FQ^nW|08&UX-E_v zK$r;k4`q{;?WAd?{7*oj_ zwtO%_A~!t9 zPmIO{OH8QImEE*eull&Bzm-#?odJgR@Dd?ju}noAxMhV^Wfr++jdi`)!zCN?SxTI< rsV=3LQ?}GO%AByRE>BhWCDLE5oMXq~j8(xm9X5n7Li~PLu7tfmHvlH^ delta 266 zcmXAjJx&5q6otPx&*ziDsZ1_px_TE3L(Ur#L5^^w#E1)u= zZ~?Zi!!4j^#^&5}&(F>M3BSYeYrXmeTJ)FULts6X_m{w!Rx-Eos7xRap~0~!JkoZk zX*Avb2WFYsRbgs_=UBM?AE3sGwj6aDQdBmNN<`9LleJw$Y1@*v2kazo8@+KU>)*4* z9tWIqMm|l`)QgDEIp;#RB4%82rPm5fX)9+bGNB{pDDlj-m?!3m8?hW+^^3S)N#1jt M4Bf83lNQkX1HpG7#Q*>R diff --git a/1ano/2semestre/poo/out/production/poo/utils/UserInput.class b/1ano/2semestre/poo/out/production/poo/utils/UserInput.class index 4ea1b410414a752b004f3f39325f57a485388e34..9748a8df5cc2b25f2ccf58f60223ad1a0da7fb5c 100644 GIT binary patch literal 1039 zcmZvb*>2N76o&sv;5JN(f$o z<)TPj@Bq9FcZe&>KaN$pB#}JZIp6vJ3# zlhI&9`p=yxXQu6So&LJxE4_|4Q{gKWP+0p2r%7jO3|xtw9hBWXu62TZ>I{_2&W)oF z0R+r}3<9S|tux1Id|5pij`iP{;TtK*sZ3JRYSmjTG|+`aG;_8Ea-GoWzJBZsW1mIR z*1SN4YAf!FKxq@vU1$^lckxTZm?nlJwI1#Xg;LAHf(FCttz1Xw<|9 z@O@02)bkONl6?2x@7{CI54fwp8P?bD`zL^XY~NeK$U+?r6PAr8Y=L_j-9$m2CF9`u zB1+TvT41H|EDNvl^KmTDcXmS)t)eF<#kT~-hx9#tlB5C&Ih{l^fsv%sJS+CJ(=!Je zS%40EnpUAWB3YrW}#t;QH|Mz%V<}18y(&nSjGxFYI%wUn9Tn01!i%ecW>2h ziwLEw!J@WVdJL(g4jzwse00$(eSNI5(y4aQXJufGbM=z6SjR?%I--HHbrkAw(0X|M k`x!iy$~n^=alK7sr-XXt7dsWy;O|ucnF9oybkMN%59X9B!2kdN diff --git a/1ano/2semestre/poo/src/aula02/AverageSpeed.java b/1ano/2semestre/poo/src/aula02/AverageSpeed.java index 532aebb..e5fbe7a 100644 --- a/1ano/2semestre/poo/src/aula02/AverageSpeed.java +++ b/1ano/2semestre/poo/src/aula02/AverageSpeed.java @@ -18,6 +18,8 @@ public class AverageSpeed { double d2 = UserInput.getPositiveNumber(sin); double vm = (d1 + d2) / ((d1 / v1) + (d2 / v2)); - System.out.printf("Velocidade final da viagem: %fkm/h", vm); + System.out.printf("Velocidade final da viagem: %.2fkm/h", vm); + + sin.close(); } } diff --git a/1ano/2semestre/poo/src/aula02/CelciusToFahrenheit.java b/1ano/2semestre/poo/src/aula02/CelciusToFahrenheit.java index fe12735..8d4d260 100644 --- a/1ano/2semestre/poo/src/aula02/CelciusToFahrenheit.java +++ b/1ano/2semestre/poo/src/aula02/CelciusToFahrenheit.java @@ -10,6 +10,8 @@ public class CelciusToFahrenheit { Scanner sin = new Scanner(System.in); double celcius = sin.nextDouble(); double fahrenheit = 1.8*celcius+32; - System.out.printf("%fºC = %fºF", celcius, fahrenheit); + System.out.printf("%.2fºC = %.2fºF", celcius, fahrenheit); + + sin.close(); } } diff --git a/1ano/2semestre/poo/src/aula02/Countdown.java b/1ano/2semestre/poo/src/aula02/Countdown.java index a3d0919..d04bffb 100644 --- a/1ano/2semestre/poo/src/aula02/Countdown.java +++ b/1ano/2semestre/poo/src/aula02/Countdown.java @@ -11,7 +11,11 @@ public class Countdown { System.out.print("N? "); int n = sin.nextInt(); for (int i = n; i >= 0; i--) { + // If the statement before '?' is true then the expression before the ':' is used, else the expression after the ':' is used. + // In python: i + "\n" if i%10 == 0 else i + "," System.out.print(i%10 == 0 ? i + "\n" : i + ","); } + + sin.close(); } } \ No newline at end of file diff --git a/1ano/2semestre/poo/src/aula02/DistanceBetweenPoints.java b/1ano/2semestre/poo/src/aula02/DistanceBetweenPoints.java index b1c5554..af1c152 100644 --- a/1ano/2semestre/poo/src/aula02/DistanceBetweenPoints.java +++ b/1ano/2semestre/poo/src/aula02/DistanceBetweenPoints.java @@ -1,5 +1,7 @@ package aula02; +import utils.UserInput; + import java.util.Scanner; // Solução do exercício 7 @@ -8,15 +10,15 @@ public class DistanceBetweenPoints { public static void main(String[] args){ Scanner sin = new Scanner(System.in); - System.out.print("Coordenadas do ponto 1 (separadas por ','): "); - String[] p1 = sin.next().split(","); - System.out.print("Coordenadas do ponto 2 (separadas por ','): "); - String[] p2 = sin.next().split(","); + String[] p1 = UserInput.input(sin, "Coordenadas do ponto 1 (separadas por ','): ").split(","); + String[] p2 = UserInput.input(sin, "Coordenadas do ponto 2 (separadas por ','): ").split(","); double distance = Math.sqrt( Math.pow(Double.parseDouble(p1[0]) - Double.parseDouble(p2[0]), 2) + Math.pow(Double.parseDouble(p1[1]) - Double.parseDouble(p2[1]), 2)); - System.out.printf("A distância entre os dois pontos é %f", distance); + System.out.printf("A distância entre os dois pontos é %.3f", distance); + + sin.close(); } } \ No newline at end of file diff --git a/1ano/2semestre/poo/src/aula02/EnergyToHeatWater.java b/1ano/2semestre/poo/src/aula02/EnergyToHeatWater.java index dcdbef5..1892a6f 100644 --- a/1ano/2semestre/poo/src/aula02/EnergyToHeatWater.java +++ b/1ano/2semestre/poo/src/aula02/EnergyToHeatWater.java @@ -16,6 +16,8 @@ public class EnergyToHeatWater { System.out.print("Temperatura final da água (ºC)? "); double finalTemperature = sin.nextDouble(); double energy = kgOfWater * (finalTemperature - initialTemperature) * 4184; - System.out.printf("Para aquecer %fkg de água de %fºC para %fºC, serão necessários %fJ de energia.", kgOfWater, initialTemperature, finalTemperature, energy); + System.out.printf("Para aquecer %.3fkg de água de %.2fºC para %.2fºC, serão necessários %.3fJ de energia.", kgOfWater, initialTemperature, finalTemperature, energy); + + sin.close(); } } diff --git a/1ano/2semestre/poo/src/aula02/Investment.java b/1ano/2semestre/poo/src/aula02/Investment.java index 53e9844..d1957b2 100644 --- a/1ano/2semestre/poo/src/aula02/Investment.java +++ b/1ano/2semestre/poo/src/aula02/Investment.java @@ -14,6 +14,8 @@ public class Investment { System.out.print("Taxa de juro mensal (%)? "); double tax = sin.nextDouble(); double finalWallet = initialWallet * Math.pow(1 + tax/100, 3); - System.out.printf("O saldo final será de %f euros", finalWallet); + System.out.printf("O saldo final será de %.2f euros", finalWallet); + + sin.close(); } } diff --git a/1ano/2semestre/poo/src/aula02/KmToMiles.java b/1ano/2semestre/poo/src/aula02/KmToMiles.java index bd8b965..2bd5b8a 100644 --- a/1ano/2semestre/poo/src/aula02/KmToMiles.java +++ b/1ano/2semestre/poo/src/aula02/KmToMiles.java @@ -12,6 +12,8 @@ public class KmToMiles { Scanner sin = new Scanner(System.in); double km = UserInput.getPositiveNumber(sin); double miles = km / 1.609; - System.out.printf("%fkm = %f miles", km, miles); + System.out.printf("%.3fkm = %.3f miles", km, miles); + + sin.close(); } } \ No newline at end of file diff --git a/1ano/2semestre/poo/src/aula02/PythagoreanTheorem.java b/1ano/2semestre/poo/src/aula02/PythagoreanTheorem.java index c912169..4487e52 100644 --- a/1ano/2semestre/poo/src/aula02/PythagoreanTheorem.java +++ b/1ano/2semestre/poo/src/aula02/PythagoreanTheorem.java @@ -17,11 +17,10 @@ public class PythagoreanTheorem { double b = UserInput.getPositiveNumber(sin); double c = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2)); + double angDeg = Math.acos(a / c) * 180 / Math.PI; - double cossin = a / c; - double angRad = Math.acos(cossin); - double angDeg = angRad * 180 / Math.PI; + System.out.printf("O comprimento da hipotenusa é %.2f e o valor do angulo entre o cateto A e a hipotenusa é %.2f°", c, angDeg); - System.out.printf("O comprimento da hipotenusa é %f e o valor do angulo entre o cateto A e a hipotenusa é %f°", MathTools.round(c, 2), MathTools.round(angDeg, 2)); + sin.close(); } } \ No newline at end of file diff --git a/1ano/2semestre/poo/src/aula02/RealNumbers.java b/1ano/2semestre/poo/src/aula02/RealNumbers.java index 3875fb7..56d5c96 100644 --- a/1ano/2semestre/poo/src/aula02/RealNumbers.java +++ b/1ano/2semestre/poo/src/aula02/RealNumbers.java @@ -29,5 +29,7 @@ public class RealNumbers { } System.out.printf("Valor máximo: %f\nValor mínimo: %f\nMédia: %f\nTotal: %f", max, min, (float) sum/readNumbers, sum); + + sin.close(); } } \ No newline at end of file diff --git a/1ano/2semestre/poo/src/aula02/SecsToHMS.java b/1ano/2semestre/poo/src/aula02/SecsToHMS.java index 1393d99..194127c 100644 --- a/1ano/2semestre/poo/src/aula02/SecsToHMS.java +++ b/1ano/2semestre/poo/src/aula02/SecsToHMS.java @@ -17,5 +17,7 @@ public class SecsToHMS { int hours = Math.round((float) (mins / 60)); mins = mins % 60; System.out.printf("%d segundos no formato hh:mm:ss : %d:%d:%d", totalSecs, hours, mins, secs); + + sin.close(); } } \ No newline at end of file