As can be seen form the image above, the software will add the number of coins that is taken. So basically, for example, if I have with me 50 dollar worth of $2 coins, I can click the $2 button and take it out. I haven't implemented the buttons to take out the coins yet. At the moment all I have done is create the GUI.
-- To update all the fields, I have decided that instead of updating one by one when I click the button, I create another method where it will update every field. I have stored values at the moment using integers. For example:
int stackTwoDollars =0;
int stackOneDollar =0;
For now, I will be happy with starting with zero just to make sure it works. Later on I plan to connect it to a database so that the values from the previous time that money was taken out can be saved.
private void updateFields() {
twoDollarsField.setText(""+stackTwoDollars);
oneDollarField.setText(""+stackOneDollar);
fiftyCentsField.setText(""+stackFiftyCents);
twentyCentsField.setText(""+stackTwentyCents);
tenCentsField.setText(""+stackTenCents);
fiveCentsField.setText(""+stackFiveCents);
}
The code above is used to update and refresh all the fields;
No comments:
Post a Comment