File tree Expand file tree Collapse file tree 2 files changed +3
-6
lines changed Expand file tree Collapse file tree 2 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ public void update() {
29
29
}
30
30
31
31
public ArrayList <String > returnCoins () {
32
+ setCoinReturnAmount (currentAmount );
32
33
returnSlotCoins .addAll (coinList );
33
34
coinList .removeAll (coinList );
34
35
setCurrentAmount (0.00 );
@@ -94,16 +95,13 @@ private void updateDisplay() {
94
95
private void updateChangeAmount () {
95
96
if (currentAmount >= 1.25 ) {
96
97
setCurrentAmount (currentAmount - 1.25 );
97
- coinList .remove (0 );
98
- coinList .remove (1 );
99
- coinList .remove (2 );
100
98
}
101
99
}
102
100
103
101
private void setCoinReturnAmount (Double coinReturnAmount ) {
104
102
this .coinReturnAmount = coinReturnAmount ;
105
103
}
106
-
104
+
107
105
private void coinAdded (String coin , double coinAmount ) {
108
106
coinList .add (coin );
109
107
coinCalc .insertCoin (coinAmount );
Original file line number Diff line number Diff line change 5
5
import java .util .ArrayList ;
6
6
7
7
import org .junit .Before ;
8
- import org .junit .Ignore ;
9
8
import org .junit .Test ;
10
9
11
10
public class VendingMachineTests {
@@ -218,7 +217,7 @@ public void machineShouldMakeChangeIfTooMuchMoneyPaidForSoda() {
218
217
vendingMachine .sodaButton ();
219
218
vendingMachine .returnCoins ();
220
219
221
- assertEquals ((Double ) QUARTER , vendingMachine .getReturnSlotCoins ());
220
+ assertEquals ((Double ) QUARTER , vendingMachine .getCoinReturnAmount ());
222
221
}
223
222
224
223
private void insertDollarInQuarters () {
You can’t perform that action at this time.
0 commit comments