forked from AllenDowney/ThinkJavaCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestVendingMachine.java
More file actions
28 lines (22 loc) · 824 Bytes
/
TestVendingMachine.java
File metadata and controls
28 lines (22 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public class TestVendingMachine
{
public static void main(String[] args)
{
VendingMachine vendingMachine = new VendingMachine();
System.out.println(vendingMachine);
vendingMachine.addQuarter();
System.out.println(vendingMachine);
vendingMachine.addQuarter();
System.out.println(vendingMachine);
vendingMachine.addDime();
System.out.println(vendingMachine);
vendingMachine.addNickel();
System.out.println(vendingMachine);
System.out.println("Buying an item");
vendingMachine.buyItem();
System.out.println(vendingMachine);
int changeReturned = vendingMachine.extractChange();
System.out.println("I got " + changeReturned + " cents back!");
System.out.println(vendingMachine);
}
}