secret
Last active

Money handler

  • Download Gist
Customer.java
Java
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 29 30 31
/*
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";
}
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.