Skip to content

Instantly share code, notes, and snippets.

@msoucy
Last active December 11, 2015 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msoucy/234ae953971ee980234a to your computer and use it in GitHub Desktop.
Save msoucy/234ae953971ee980234a to your computer and use it in GitHub Desktop.
Money handler
/*
This is some code written by one of my group members.
Copied verbatim from his email...
The intent was store money for a "vending machine" simulation
*/
package Core;
import org.json.simple.JSONObject;
public class Customer implements VendingMachine {
public int insertMoney(int money) {
return money;
}
public int returnMoney(int money, int price){
int returnMoney = money - price;
return returnMoney;
}
public String purchaseItem(String name, int price){
if(money >= price){
return name;
}
else{
return "You have insuffeicent funds";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment