Commit 08b37074 by Adam Gerber

again programming to interfaces

parent 496eae85
package lec07.glab.vend;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
......@@ -18,7 +19,7 @@ public class Driver {
VendMachine vndMachine = new VendMachine();
ArrayList<Product> prdProducts = new ArrayList<>();
List<Product> prdProducts = new ArrayList<>();
prdProducts.add(new Product("Heath", 0.75));
prdProducts.add(new Product("PayDay", 0.75));
prdProducts.add(new Product("Reces", 0.75));
......@@ -48,7 +49,7 @@ public class Driver {
System.out.println(vndMachine.showSelection());
strSelect = makeSelection();
if (strSelect.equalsIgnoreCase("AABBCC")){
ArrayList<Coin> conCashOuts = vndMachine.cashOut();
List<Coin> conCashOuts = vndMachine.cashOut();
System.out.println("Jackpot!");
for (Coin conCashOut : conCashOuts) {
System.out.println(conCashOut);
......@@ -60,7 +61,7 @@ public class Driver {
System.out.println("Thank you and Enjoy: " + prdProduct);
else {
System.out.print("You inserted " + vndMachine.howMuchInserted() + " : Insufficient coins or out of stock");
ArrayList<Coin> conReturns = vndMachine.returnCoins();
List<Coin> conReturns = vndMachine.returnCoins();
System.out.println(", here is your money back: ");
for (Coin conReturn : conReturns) {
System.out.println(conReturn);
......
......@@ -72,7 +72,7 @@ public class VendMachine {
}
public void stockMe(ArrayList<Product> prdProducts){
public void stockMe(List<Product> prdProducts){
//for each row
//for each col
......@@ -145,7 +145,7 @@ public class VendMachine {
}
public void insertCoins(ArrayList<Coin> conPassed){
public void insertCoins(List<Coin> conPassed){
for (Coin con : conPassed) {
mPurchaseMoneys.add(con);
}
......@@ -154,7 +154,7 @@ public class VendMachine {
}
public void insertCoins(String strCoinValue){
ArrayList<Coin> conCoins = new ArrayList<>();
List<Coin> conCoins = new ArrayList<>();
String[] strCoins = strCoinValue.split(" ");
for (String strCoin : strCoins) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment