I typed up this class, and just want to get some feedback and some help from you guys. I'll post the problem, and if you guys don't mind critiquing I would appreciate it. Also, I'm a little confused on how the interface of this will work when executed in a main class.
Design a class that keeps track of a student’s food purchases at the campus cafeteria. A meal card is assigned to an individual student. When a meal card is first issued, the balance is set to the number of points. If the student does not specify the number of points, then the initial balance is set to 100 points. Points assigned to each food item are a whole number. A student can purchase additional points at any time during a semester. Every time food items are bought, points are deducted from the balance. If the balance becomes negative, the purchase of food items is not allowed. There is obviously more than one way to implement the MealCard class. Any design that supports the key functionalities is acceptable. Put this class in the myutil package.
public class MealCard { private static int balance; private final static int START_BALANCE = 100; public MealCard(){ this(balance = START_BALANCE); } public MealCard(int bal) { balance = bal; } public int deductBalance(int cost){ if((balance-cost) >= 0){ balance -= cost; } else if((balance - cost) < 0){ System.out.println("Insufficient Funds."); } return balance; } public int buyPoints(int amt){ return balance += amt; } }