You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 0-BASICO/2-estrutura-sequencial.md
+71-1Lines changed: 71 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,76 @@ public class Main {
48
48
49
49
- BONUS: De forma que o desperdício de tinta seja menor. Acrescente 10% de folga e sempre arredonde os valores para cima, isto é, considere latas cheias.
50
50
51
+
**Resolução:**
52
+
53
+
<details>
54
+
<summary>Spoiler warning</summary>
55
+
51
56
```java
52
-
TODO
57
+
importjava.util.Scanner;
58
+
importjava.lang.Math;
59
+
60
+
publicclassMain {
61
+
publicstaticvoidmain(String[] args) {
62
+
double tintaLitrosPreco =80.0;
63
+
double tintaGaloesPreco =25.0;
64
+
double tintaLitros =18.0;
65
+
double tintaGaloes =3.6;
66
+
Scanner scanner =newScanner(System.in);
67
+
double areaPintar =0.0;
68
+
69
+
70
+
try {
71
+
System.out.println("Digite o tamanho em metros quadrados da área a ser pintada: ");
72
+
areaPintar = scanner.nextDouble();
73
+
74
+
if (areaPintar <=0) {
75
+
System.out.println("Por favor, digite um valor maior que zero.");
76
+
return;
77
+
}
78
+
79
+
// 10% de folga
80
+
double areaComFolga = areaPintar *1.1;
81
+
double litrosNecessarios = areaComFolga /6;
82
+
83
+
// Apenas latas
84
+
int latasApenas = (int) Math.ceil(litrosNecessarios / tintaLitros);
0 commit comments