Skip to content

Commit 7a67c81

Browse files
authored
Fix Is#10
1 parent e260abd commit 7a67c81

File tree

1 file changed

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

1 file changed

+8
-8
lines changed

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

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

33
import java.util.Iterator;
44

5-
/**
6-
*
7-
* @author Calebe de Paula Bianchini
8-
*/
9-
class Troco {
10-
11-
public Troco(int valor) {
5+
public class Troco1{
6+
public Troco1(int valor) {
127
PapelMoeda[] papeisMoeda;
138
int novoValor;
149
int valorOriginal=valor;
@@ -23,8 +18,12 @@ public Troco(int valor) {
2318
}
2419
papeisMoeda[5] = new PapelMoeda(100, count);
2520
count = 0;
26-
while (valor % 50 != 0) {
21+
while (true) {
22+
novoValor=novoValor-50;
2723
count++;
24+
if(novoValor<50){
25+
break;
26+
}
2827
}
2928
papeisMoeda[4] = new PapelMoeda(50, count);
3029
count = 0;
@@ -53,3 +52,4 @@ public Iterator<PapelMoeda> getIterator() {
5352
return new TrocoIterator(this);
5453
}
5554
}
55+

0 commit comments

Comments
 (0)