We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 48a0fd5 commit ba75ca2Copy full SHA for ba75ca2
Source Code Inspection/src/br/calebe/ticketmachine/core/Troco.java
@@ -1,9 +1,7 @@
1
package br.calebe.ticketmachine.core;
2
3
-import java.util.Iterator;
4
-
5
-public class Troco2 {
6
- public Troco2(int valor) {
+public class Troco3 {
+ public Troco3(int valor) {
7
PapelMoeda[] papeisMoeda;
8
int novoValor;
9
int valorOriginal=valor;
@@ -36,8 +34,12 @@ public Troco2(int valor) {
36
34
}
37
35
papeisMoeda[3] = new PapelMoeda(20, count);
38
count = 0;
39
- while (valor % 10 != 0) {
+ while (true) {
+ novoValor=novoValor-10;
40
count++;
+ if(novoValor<10){
41
+ break;
42
+ }
43
44
papeisMoeda[2] = new PapelMoeda(10, count);
45
@@ -57,3 +59,4 @@ public Iterator<PapelMoeda> getIterator() {
57
59
58
60
61
62
+
0 commit comments