Skip to content

Commit ba75ca2

Browse files
authored
Fix Is#12
1 parent 48a0fd5 commit ba75ca2

File tree

1 file changed

+8
-5
lines changed
  • Source Code Inspection/src/br/calebe/ticketmachine/core

1 file changed

+8
-5
lines changed

Source Code Inspection/src/br/calebe/ticketmachine/core/Troco.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package br.calebe.ticketmachine.core;
22

3-
import java.util.Iterator;
4-
5-
public class Troco2 {
6-
public Troco2(int valor) {
3+
public class Troco3 {
4+
public Troco3(int valor) {
75
PapelMoeda[] papeisMoeda;
86
int novoValor;
97
int valorOriginal=valor;
@@ -36,8 +34,12 @@ public Troco2(int valor) {
3634
}
3735
papeisMoeda[3] = new PapelMoeda(20, count);
3836
count = 0;
39-
while (valor % 10 != 0) {
37+
while (true) {
38+
novoValor=novoValor-10;
4039
count++;
40+
if(novoValor<10){
41+
break;
42+
}
4143
}
4244
papeisMoeda[2] = new PapelMoeda(10, count);
4345
count = 0;
@@ -57,3 +59,4 @@ public Iterator<PapelMoeda> getIterator() {
5759
}
5860
}
5961

62+

0 commit comments

Comments
 (0)