hi people
I am building a atm machine but havent actually coding it as yet, just the gui interface part i have done so far because i am doing something else at the moment but in between i would do someting with it. so i have put in an if and else statement.
the atm should be work like this, when a person deposit any amount a pop box will tell u the money is deposit. it should also show u your current balance, bal enquiry, be able to get fast cash and able to widthdrawal right.
I have started with the widthdrawal part for. well i mean am just testing it out so i put in an if and else statement. the things is with the widthdrawal, i have put a limit to which a user can widthdraw, if the user goes beyond the required widthdrawal amount, a pop box will tell the user that it is an invalid transaction, meaning that the transaction entered exceeded the amount, but for some reason it only goes to the part where it tells the user to take the case when the wrong amount is entered when it should go to the else statement to tell the user that the wrong amount has been entered.
tell me what i have done wrong. I havent been programming for a while eh. here is the code that i used .
it is the same for the savings and the chequeing account.
any help will be appreciated.
private void jbtn_savingsWidrawalActionPerformed(java.awt.event.ActionEvent evt) {
double moneyDeposit = 0;
if(moneyDeposit > 2000)
{
JOptionPane.showMessageDialog(null, "Invalid transaction amount");
}
else
{
JOptionPane.showMessageDialog(null, "Please take your cash");
}
}
private void jbtn_chequeWidrawalActionPerformed(java.awt.event.ActionEvent evt) {
double cash_widthdrawal=0;
if(cash_widthdrawal == 2000)
{
JOptionPane.showMessageDialog(null, "Please take your cash");
}
else if(cash_widthdrawal > 2000)
{
JOptionPane.showMessageDialog(null, "Invalid transaction");
}
}