From f533593adc2ea04178b5e7db15387cf8564097e8 Mon Sep 17 00:00:00 2001 From: TiagoRG <35657250+TiagoRG@users.noreply.github.com> Date: Mon, 20 Feb 2023 14:17:23 +0000 Subject: [PATCH 1/3] Moved Python-Java-Comparison.pdf to slides --- .../poo/{ => slides}/Python-Java-Comparison.pdf | Bin 1 file changed, 0 insertions(+), 0 deletions(-) rename 1ano/2semestre/poo/{ => slides}/Python-Java-Comparison.pdf (100%) diff --git a/1ano/2semestre/poo/Python-Java-Comparison.pdf b/1ano/2semestre/poo/slides/Python-Java-Comparison.pdf similarity index 100% rename from 1ano/2semestre/poo/Python-Java-Comparison.pdf rename to 1ano/2semestre/poo/slides/Python-Java-Comparison.pdf From b1e7352bfc108b5947c331ec3bb119604bedb314 Mon Sep 17 00:00:00 2001 From: TiagoRG <35657250+TiagoRG@users.noreply.github.com> Date: Mon, 20 Feb 2023 14:20:27 +0000 Subject: [PATCH 2/3] Added references to utils package on aula02 classes --- 1ano/2semestre/poo/src/aula02/AverageSpeed.java | 3 +++ 1ano/2semestre/poo/src/aula02/DistanceBetweenPoints.java | 2 ++ 1ano/2semestre/poo/src/aula02/EnergyToHeatWater.java | 2 ++ 1ano/2semestre/poo/src/aula02/Investment.java | 2 ++ 1ano/2semestre/poo/src/aula02/KmToMiles.java | 2 ++ 1ano/2semestre/poo/src/aula02/PythagoreanTheorem.java | 3 ++- 1ano/2semestre/poo/src/aula02/SecsToHMS.java | 2 ++ 7 files changed, 15 insertions(+), 1 deletion(-) diff --git a/1ano/2semestre/poo/src/aula02/AverageSpeed.java b/1ano/2semestre/poo/src/aula02/AverageSpeed.java index e5fbe7a..28c95e5 100644 --- a/1ano/2semestre/poo/src/aula02/AverageSpeed.java +++ b/1ano/2semestre/poo/src/aula02/AverageSpeed.java @@ -1,6 +1,9 @@ package aula02; import java.util.Scanner; + +// Código da package utils disponível em +// https://github.com/TiagoRG/uaveiro-leci/tree/master/1ano/2semestre/poo/src/utils import utils.UserInput; // Solução do exercício 5 diff --git a/1ano/2semestre/poo/src/aula02/DistanceBetweenPoints.java b/1ano/2semestre/poo/src/aula02/DistanceBetweenPoints.java index af1c152..c1f286f 100644 --- a/1ano/2semestre/poo/src/aula02/DistanceBetweenPoints.java +++ b/1ano/2semestre/poo/src/aula02/DistanceBetweenPoints.java @@ -1,5 +1,7 @@ package aula02; +// Código da package utils disponível em +// https://github.com/TiagoRG/uaveiro-leci/tree/master/1ano/2semestre/poo/src/utils import utils.UserInput; import java.util.Scanner; diff --git a/1ano/2semestre/poo/src/aula02/EnergyToHeatWater.java b/1ano/2semestre/poo/src/aula02/EnergyToHeatWater.java index 1892a6f..020222b 100644 --- a/1ano/2semestre/poo/src/aula02/EnergyToHeatWater.java +++ b/1ano/2semestre/poo/src/aula02/EnergyToHeatWater.java @@ -1,5 +1,7 @@ package aula02; +// Código da package utils disponível em +// https://github.com/TiagoRG/uaveiro-leci/tree/master/1ano/2semestre/poo/src/utils import utils.UserInput; import java.util.Scanner; diff --git a/1ano/2semestre/poo/src/aula02/Investment.java b/1ano/2semestre/poo/src/aula02/Investment.java index d1957b2..5c1ecf9 100644 --- a/1ano/2semestre/poo/src/aula02/Investment.java +++ b/1ano/2semestre/poo/src/aula02/Investment.java @@ -1,5 +1,7 @@ package aula02; +// Código da package utils disponível em +// https://github.com/TiagoRG/uaveiro-leci/tree/master/1ano/2semestre/poo/src/utils import utils.UserInput; import java.util.Scanner; diff --git a/1ano/2semestre/poo/src/aula02/KmToMiles.java b/1ano/2semestre/poo/src/aula02/KmToMiles.java index 2bd5b8a..6dda001 100644 --- a/1ano/2semestre/poo/src/aula02/KmToMiles.java +++ b/1ano/2semestre/poo/src/aula02/KmToMiles.java @@ -1,5 +1,7 @@ package aula02; +// Código da package utils disponível em +// https://github.com/TiagoRG/uaveiro-leci/tree/master/1ano/2semestre/poo/src/utils import utils.UserInput; import java.util.Scanner; diff --git a/1ano/2semestre/poo/src/aula02/PythagoreanTheorem.java b/1ano/2semestre/poo/src/aula02/PythagoreanTheorem.java index 4487e52..33baffd 100644 --- a/1ano/2semestre/poo/src/aula02/PythagoreanTheorem.java +++ b/1ano/2semestre/poo/src/aula02/PythagoreanTheorem.java @@ -1,6 +1,7 @@ package aula02; -import utils.MathTools; +// Código da package utils disponível em +// https://github.com/TiagoRG/uaveiro-leci/tree/master/1ano/2semestre/poo/src/utils import utils.UserInput; import java.util.Scanner; diff --git a/1ano/2semestre/poo/src/aula02/SecsToHMS.java b/1ano/2semestre/poo/src/aula02/SecsToHMS.java index 194127c..77c7597 100644 --- a/1ano/2semestre/poo/src/aula02/SecsToHMS.java +++ b/1ano/2semestre/poo/src/aula02/SecsToHMS.java @@ -1,5 +1,7 @@ package aula02; +// Código da package utils disponível em +// https://github.com/TiagoRG/uaveiro-leci/tree/master/1ano/2semestre/poo/src/utils import utils.UserInput; import java.util.Scanner; From d167f7bb9ae397a03ce03721571f2b596c221edc Mon Sep 17 00:00:00 2001 From: TiagoRG <35657250+TiagoRG@users.noreply.github.com> Date: Mon, 20 Feb 2023 14:25:36 +0000 Subject: [PATCH 3/3] Added new lines to the end of execution --- .../production/poo/aula02/AverageSpeed.class | Bin 1221 -> 1222 bytes .../poo/aula02/CelciusToFahrenheit.class | Bin 1065 -> 1066 bytes .../poo/aula02/DistanceBetweenPoints.class | Bin 1465 -> 1466 bytes .../poo/aula02/EnergyToHeatWater.class | Bin 1410 -> 1411 bytes .../production/poo/aula02/Investment.class | Bin 1268 -> 1269 bytes .../out/production/poo/aula02/KmToMiles.class | Bin 1060 -> 1061 bytes .../poo/aula02/PythagoreanTheorem.class | Bin 1376 -> 1377 bytes .../production/poo/aula02/RealNumbers.class | Bin 1389 -> 1390 bytes .../out/production/poo/aula02/SecsToHMS.class | Bin 1244 -> 1245 bytes .../out/production/poo/tp_codecheck/README.md | 6 ++++++ .../poo/src/aula02/AverageSpeed.java | 2 +- .../poo/src/aula02/CelciusToFahrenheit.java | 2 +- .../poo/src/aula02/DistanceBetweenPoints.java | 2 +- .../poo/src/aula02/EnergyToHeatWater.java | 2 +- 1ano/2semestre/poo/src/aula02/Investment.java | 2 +- 1ano/2semestre/poo/src/aula02/KmToMiles.java | 2 +- .../poo/src/aula02/PythagoreanTheorem.java | 2 +- .../2semestre/poo/src/aula02/RealNumbers.java | 2 +- 1ano/2semestre/poo/src/aula02/SecsToHMS.java | 2 +- 19 files changed, 15 insertions(+), 9 deletions(-) create mode 100755 1ano/2semestre/poo/out/production/poo/tp_codecheck/README.md diff --git a/1ano/2semestre/poo/out/production/poo/aula02/AverageSpeed.class b/1ano/2semestre/poo/out/production/poo/aula02/AverageSpeed.class index c4eab1f640f88d994eedc03a1b83f825b71852da..cf290548db88b519f4cd6cdc19e53e76810140f9 100644 GIT binary patch delta 78 zcmX@gd5m+z3`R!P$uk*MH}7S<$;ik(c{=k_LtX}M20jL127U$!1_1^I20;cj1|bGL gpoj^B2!joSD1#G&I70|fHj_b$A(ugVaxO~*0GL4ym;e9( delta 78 zcmX@cd6aX*3`Rzk$uk*MH}7Y>!N|xlc?R=RLoNnxAQWccVUS?pWl&(?V^Cw@XV7C1 hU@&12WUyfnVsK&*VF+OmWyoX@XUJucn4HHF0RWR<4R8Pe diff --git a/1ano/2semestre/poo/out/production/poo/aula02/CelciusToFahrenheit.class b/1ano/2semestre/poo/out/production/poo/aula02/CelciusToFahrenheit.class index fd19361cf800b142f23b01a50937d483495199b0..43c5fc409fa3ff0facffdfdcdbf8477c394c74a3 100644 GIT binary patch delta 32 jcmZ3~J=RbB>e27U%{1_1_T1|bGD24MzE1`!4? VAlsioj3I?Vf+2%Ja&jrF3jh^I4B!9& delta 66 zcmdnRy_0*xBqm19$&;D1Ht%El#K_1wc_YgLRc;1u23`hn20jL51_1^&20;c(1|bG7 VAlsiogdv4Nj3I+Td~zA93jh;K49oxk diff --git a/1ano/2semestre/poo/out/production/poo/aula02/EnergyToHeatWater.class b/1ano/2semestre/poo/out/production/poo/aula02/EnergyToHeatWater.class index 858177db34133faf36a540f499febac224c56145..0ec5dff06e4ece42d624d05ff25f36ccf085f07d 100644 GIT binary patch delta 70 zcmZqTZsy+blaVoI@-N1i&7n*@OpM%D-)yQWHu(H&6-Si85ubzv$J$6ax-u<@GuB7@G?j+@G&Sb@H40}2ryVM R2r~ErMFSZ`CU0bM0RVfA3I_lH diff --git a/1ano/2semestre/poo/out/production/poo/aula02/KmToMiles.class b/1ano/2semestre/poo/out/production/poo/aula02/KmToMiles.class index 0d2e8cc775c4ae7cbb33bdfc1c1d129d9111490c..adde2b5a3a60a9c5ef9d6704d8470e604e9fe844 100644 GIT binary patch delta 70 zcmZ3&v6N#&BcrH@s-AILcCLc00*IlIo0*eZ%(Zzc;}J$i?#WTi<&wM%91MI6!VLTj W5)1+i@(h9u)~y X415go4Ezk%41x^y3__D%Gg|=wS^W;5 diff --git a/1ano/2semestre/poo/out/production/poo/aula02/PythagoreanTheorem.class b/1ano/2semestre/poo/out/production/poo/aula02/PythagoreanTheorem.class index bf8e1f6e4ceac03a598a54e303571b01e2f2b13d..3802356144a42ecb514e6f70bde29adb81ac2da6 100644 GIT binary patch delta 66 zcmaFB^^j}BKSsu+$^RLXHYYGWXJq7_?7^~Bm6w5=fuBK`L4ZMmL6AX#L5M+(L4?7Y WL6pIVL7X9zL6RYtL29xPs~-SGRt+Km delta 66 zcmaFJ^?+-`KSsvH$^RLXHYYJXV`Su-?8&lJm4|_wfsa9$fuBKwL4ZMlL6AWW$g^e; UVenxPW5@)G<}yf57H0JW07P#M82|tP diff --git a/1ano/2semestre/poo/out/production/poo/aula02/RealNumbers.class b/1ano/2semestre/poo/out/production/poo/aula02/RealNumbers.class index e2a559102e8f05e041cce55ddfd81eda740232c4..96ff9d6195b147a59c2ce471c2c14e56b1043f74 100644 GIT binary patch delta 18 acmaFM^^R*p8Y83SM&GQ-0F#`ZYSO%E@ delta 18 acmaFI^_FWx8Y82{M%?laNG6MiZRtA{> diff --git a/1ano/2semestre/poo/out/production/poo/aula02/SecsToHMS.class b/1ano/2semestre/poo/out/production/poo/aula02/SecsToHMS.class index e78b87b5aa57a371a5392c8ecafb915051124973..8f6ac3d379820c118e929a8f2e1dc61a6e66d41e 100644 GIT binary patch delta 66 zcmcb^d6#p;K}JUH$%h!VH@{)L&B(|-`2_PqRbB>e27U%%1_1_120;cn1|bFwAkUaV Vgu#kIlp&QtoFS7zVsamg9{@e64SWCq delta 66 zcmcc1d53euK}JTc$%h!VH@{=N#mLAx`6Tl~Rc;1u23`hX20jK!27U%P1_1^Q20;d6 V1|bG3plB+CC_^TL*yMf|KL9(e4QK!W diff --git a/1ano/2semestre/poo/out/production/poo/tp_codecheck/README.md b/1ano/2semestre/poo/out/production/poo/tp_codecheck/README.md new file mode 100755 index 0000000..f49dbb0 --- /dev/null +++ b/1ano/2semestre/poo/out/production/poo/tp_codecheck/README.md @@ -0,0 +1,6 @@ +# Programação Orientada a Objetos +## Exercícios TP +### Resoluções para exercícios sugeridos nas aulas Teórico-Práticas + +--- +*Pode conter erros, caso encontre algum, crie um* [*ticket*](https://github.com/TiagoRG/uaveiro-leci/issues/new) diff --git a/1ano/2semestre/poo/src/aula02/AverageSpeed.java b/1ano/2semestre/poo/src/aula02/AverageSpeed.java index 28c95e5..6f1b11d 100644 --- a/1ano/2semestre/poo/src/aula02/AverageSpeed.java +++ b/1ano/2semestre/poo/src/aula02/AverageSpeed.java @@ -21,7 +21,7 @@ public class AverageSpeed { double d2 = UserInput.getPositiveNumber(sin); double vm = (d1 + d2) / ((d1 / v1) + (d2 / v2)); - System.out.printf("Velocidade final da viagem: %.2fkm/h", vm); + System.out.printf("Velocidade final da viagem: %.2fkm/h\n", vm); sin.close(); } diff --git a/1ano/2semestre/poo/src/aula02/CelciusToFahrenheit.java b/1ano/2semestre/poo/src/aula02/CelciusToFahrenheit.java index 8d4d260..2a5f030 100644 --- a/1ano/2semestre/poo/src/aula02/CelciusToFahrenheit.java +++ b/1ano/2semestre/poo/src/aula02/CelciusToFahrenheit.java @@ -10,7 +10,7 @@ public class CelciusToFahrenheit { Scanner sin = new Scanner(System.in); double celcius = sin.nextDouble(); double fahrenheit = 1.8*celcius+32; - System.out.printf("%.2fºC = %.2fºF", celcius, fahrenheit); + System.out.printf("%.2fºC = %.2fºF\n", celcius, fahrenheit); sin.close(); } diff --git a/1ano/2semestre/poo/src/aula02/DistanceBetweenPoints.java b/1ano/2semestre/poo/src/aula02/DistanceBetweenPoints.java index c1f286f..f936bec 100644 --- a/1ano/2semestre/poo/src/aula02/DistanceBetweenPoints.java +++ b/1ano/2semestre/poo/src/aula02/DistanceBetweenPoints.java @@ -19,7 +19,7 @@ public class DistanceBetweenPoints { 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 é %.3f", distance); + System.out.printf("A distância entre os dois pontos é %.3f\n", distance); sin.close(); } diff --git a/1ano/2semestre/poo/src/aula02/EnergyToHeatWater.java b/1ano/2semestre/poo/src/aula02/EnergyToHeatWater.java index 020222b..1c3b9e0 100644 --- a/1ano/2semestre/poo/src/aula02/EnergyToHeatWater.java +++ b/1ano/2semestre/poo/src/aula02/EnergyToHeatWater.java @@ -18,7 +18,7 @@ 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 %.3fkg de água de %.2fºC para %.2fºC, serão necessários %.3fJ 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.\n", 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 5c1ecf9..19fb880 100644 --- a/1ano/2semestre/poo/src/aula02/Investment.java +++ b/1ano/2semestre/poo/src/aula02/Investment.java @@ -16,7 +16,7 @@ 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 %.2f euros", finalWallet); + System.out.printf("O saldo final será de %.2f euros\n", finalWallet); sin.close(); } diff --git a/1ano/2semestre/poo/src/aula02/KmToMiles.java b/1ano/2semestre/poo/src/aula02/KmToMiles.java index 6dda001..ecacd6e 100644 --- a/1ano/2semestre/poo/src/aula02/KmToMiles.java +++ b/1ano/2semestre/poo/src/aula02/KmToMiles.java @@ -14,7 +14,7 @@ public class KmToMiles { Scanner sin = new Scanner(System.in); double km = UserInput.getPositiveNumber(sin); double miles = km / 1.609; - System.out.printf("%.3fkm = %.3f miles", km, miles); + System.out.printf("%.3fkm = %.3f miles\n", km, miles); sin.close(); } diff --git a/1ano/2semestre/poo/src/aula02/PythagoreanTheorem.java b/1ano/2semestre/poo/src/aula02/PythagoreanTheorem.java index 33baffd..2a97f93 100644 --- a/1ano/2semestre/poo/src/aula02/PythagoreanTheorem.java +++ b/1ano/2semestre/poo/src/aula02/PythagoreanTheorem.java @@ -20,7 +20,7 @@ public class PythagoreanTheorem { double c = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2)); double angDeg = Math.acos(a / c) * 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 é %.2f e o valor do angulo entre o cateto A e a hipotenusa é %.2f°\n", c, angDeg); sin.close(); } diff --git a/1ano/2semestre/poo/src/aula02/RealNumbers.java b/1ano/2semestre/poo/src/aula02/RealNumbers.java index 56d5c96..76969bf 100644 --- a/1ano/2semestre/poo/src/aula02/RealNumbers.java +++ b/1ano/2semestre/poo/src/aula02/RealNumbers.java @@ -28,7 +28,7 @@ public class RealNumbers { ++readNumbers; } - System.out.printf("Valor máximo: %f\nValor mínimo: %f\nMédia: %f\nTotal: %f", max, min, (float) sum/readNumbers, sum); + System.out.printf("Valor máximo: %f\nValor mínimo: %f\nMédia: %f\nTotal: %f\n", max, min, (float) sum/readNumbers, sum); sin.close(); } diff --git a/1ano/2semestre/poo/src/aula02/SecsToHMS.java b/1ano/2semestre/poo/src/aula02/SecsToHMS.java index 77c7597..20b3aad 100644 --- a/1ano/2semestre/poo/src/aula02/SecsToHMS.java +++ b/1ano/2semestre/poo/src/aula02/SecsToHMS.java @@ -18,7 +18,7 @@ public class SecsToHMS { int mins = Math.round((float) (totalSecs / 60)); 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); + System.out.printf("%d segundos no formato hh:mm:ss : %d:%d:%d\n", totalSecs, hours, mins, secs); sin.close(); }