Skip to content

Commit 48a0fd5

Browse files
authored
Fix Is#11
1 parent 7a67c81 commit 48a0fd5

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • Source Code Inspection/src/br/calebe/ticketmachine/core

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import java.util.Iterator;
44

5-
public class Troco1{
6-
public Troco1(int valor) {
5+
public class Troco2 {
6+
public Troco2(int valor) {
77
PapelMoeda[] papeisMoeda;
88
int novoValor;
99
int valorOriginal=valor;
@@ -27,8 +27,12 @@ public Troco1(int valor) {
2727
}
2828
papeisMoeda[4] = new PapelMoeda(50, count);
2929
count = 0;
30-
while (valor % 20 != 0) {
30+
while (true) {
31+
novoValor=novoValor-20;
3132
count++;
33+
if(novoValor<20){
34+
break;
35+
}
3236
}
3337
papeisMoeda[3] = new PapelMoeda(20, count);
3438
count = 0;

0 commit comments

Comments
 (0)