Commit 496eae85 by Adam Gerber

interfaces List<>

parent a6c598f2
Showing with 7 additions and 6 deletions
...@@ -2,6 +2,7 @@ package lec07.glab.vend; ...@@ -2,6 +2,7 @@ package lec07.glab.vend;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
...@@ -53,9 +54,9 @@ public class VendMachine { ...@@ -53,9 +54,9 @@ public class VendMachine {
private static DecimalFormat sDecimalFormat = new DecimalFormat("$0.00"); private static DecimalFormat sDecimalFormat = new DecimalFormat("$0.00");
//hold the vending machine's bank //hold the vending machine's bank
private ArrayList<Coin> mBanks; private List<Coin> mBanks;
//hold user's money until vending //hold user's money until vending
private ArrayList<Coin> mPurchaseMoneys; private List<Coin> mPurchaseMoneys;
private Map<String, Product[]> mapProducts; private Map<String, Product[]> mapProducts;
...@@ -216,14 +217,14 @@ public class VendMachine { ...@@ -216,14 +217,14 @@ public class VendMachine {
} }
public ArrayList<Coin> returnCoins(){ public List<Coin> returnCoins(){
ArrayList<Coin> conTemps = mPurchaseMoneys; List<Coin> conTemps = mPurchaseMoneys;
mPurchaseMoneys = new ArrayList<>(); mPurchaseMoneys = new ArrayList<>();
return conTemps; return conTemps;
} }
public ArrayList<Coin> cashOut(){ public List<Coin> cashOut(){
ArrayList<Coin> conTemp = mBanks; List<Coin> conTemp = mBanks;
//reset the bank //reset the bank
mBanks = new ArrayList<>(); mBanks = new ArrayList<>();
return conTemp; return conTemp;
......
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