Commit 0732ab89 authored by Tom's avatar Tom

Vending Machine Resit

parent d9606378
......@@ -131,10 +131,23 @@ public class VendingMachineClass extends javax.swing.JFrame implements ActionLis
}
//If the purchased button is clicked the following will happen
if(e.getActionCommand().equals("Purchase")) {
jTextField3.setText(jComboBox1.getSelectedItem().toString() + " Purchased");
//every time the button is clicked, the cost will go up by 1 and the stock will go down by 1
cost = cost + 1;
stock = stock - 1;
jTextField2.setText("" + cost);
}
if (stock == 0) {
jTextArea1.setText("Sorry, we are currently out of stock");
}
if(e.getActionCommand().equals("Cost")) {
System.out.print("Test");
jTextArea1.setText("That Will be " + cost + "!\n\nThank You For Your Purchase");
System.out.print("Working");
cost = 0;
}
}
......
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 to comment