
please show me how can this show the right output that i need please continue doing this program using only if else and do while please please" here is the problem
Automatic Teller Machine [B] Balance [D] Deposit [W] Withdrawal [Q] Quit select you OPtions:
once i have chosen an option then i should proceed here
if i choose b:
YOur Balance is __
if i chose D:
Enter you deposit amount:
if i choose W:
Enter the Withdrawal amount:
(if balance is >= withdrwal display transaction, if balance is < withdrawal display "insufficient Amount" every after each of the choices a window like this should come out:
Would you Like to generate bank slip? YES NO
if yes: for balance:
BALANCE INQUIRY AMOUNT BALANCE:
Printing bank slip.... for deposit: DEPOSIT AMOUNT:_ printing book slip:
for withdrawal: your withdrwal amount:
if no: it will return to: Would you like another transaction?
...
heres the code thati did:
/**
* @param args
*/
public static void main(String[] args) {
String a =(JOptionPane.showInputDialog(null, "Automatic Teller Machine\n [B] Balance Inquiry\n [D]Deposit\n [W] Withdrawal\n [Q] Quit\n Select you Options: ","Automatic Teller Machine",JOptionPane.PLAIN_MESSAGE));
String B= "B"; String D="D"; String W="W"; String Q="Q"; String b = "b"; int balance= 0; int deposit = 0; int withdraw= 0; double bal = 0;
int ans = 0; int trans = 0;
do { if(a.equalsIgnoreCase(B)) { { JOptionPane.showMessageDialog(null, "Your Balance is: ","BALANCE INQUIRY"+ bal,JOptionPane.PLAIN_MESSAGE );
bal=bal+deposit;
}
ans=JOptionPane.showConfirmDialog(null, "Would you like to generate bank slip?","Generate Bank Slip",JOptionPane.YES_NO_OPTION);
if (ans == 1);
{ //no
trans =JOptionPane.showConfirmDialog(null,"Would You Like Another Transaction?","Another Transaction",JOptionPane.YES_NO_OPTION);
if (trans == 1)
{
JOptionPane.showMessageDialog(null, "Thanks For Using My Program!!");
System.exit(0);
}
else if (trans == 0)
{
b =(JOptionPane.showInputDialog(null, "Automatic Teller Machine\n [B] Balance Inquiry\n [D]Deposit\n [W] Withdrawal\n [Q] Quit\n Select you Options: ","Automatic Teller Machine",JOptionPane.PLAIN_MESSAGE));
}
else if (ans == 0); // yes
{ JOptionPane.showMessageDialog(null, "BALANCE INQUIRY \n AMOUNT BALANCE: "+ bal+ "\nPrinting Bank slip.....");
}
}
}
else if (a.equalsIgnoreCase(D))
{
int dep =Integer.parseInt(JOptionPane.showInputDialog (null,"Enter Your Deposit Amount" ));
if (ans == 1);
{ //no
trans =JOptionPane.showConfirmDialog(null,"Would You Like Another Transaction?","Another Transaction",JOptionPane.YESNOOPTION);
if (trans == 1)
{
JOptionPane.showMessageDialog(null, "Thanks For Using My Program!!");
System.exit(0);
}
else if (trans == 0)
{
b=(JOptionPane.showInputDialog(null, "Automatic Teller Machine\n [B] Balance Inquiry\n [D]Deposit\n [W] Withdrawal\n [Q] Quit\n Select you Options: ","Automatic Teller Machine",JOptionPane.PLAIN_MESSAGE));
}
else if (ans == 0); // yes
{ JOptionPane.showMessageDialog(null, "BALANCE INQUIRY \n AMOUNT BALANCE: "+ deposit+ "\nPrinting Bank slip.....");
}
}
}
else if (a.equalsIgnoreCase(W))
{
int wht= Integer.parseInt(JOptionPane.showInputDialog(null," Enter the Withdrawal Amount:"));
}
ans=JOptionPane.showConfirmDialog(null, "Would you like to generate bank slip?","Generate Bank Slip",JOptionPane.YES_NO_OPTION);
if (ans == 1)
{ //no
JOptionPane.showConfirmDialog(null,"Would You Like Another Transaction?","Another Transaction",JOptionPane.YES_NO_OPTION);
if (trans == 1)
{
JOptionPane.showMessageDialog(null, "Thanks For Using My Program!!");
}
else if (trans == 0)
{
b =(JOptionPane.showInputDialog(null, "Automatic Teller Machine\n [B] Balance Inquiry\n [D]Deposit\n [W] Withdrawal\n [Q] Quit\n Select you Options: ","Automatic Teller Machine",JOptionPane.PLAIN_MESSAGE));
}
else if (ans == 0)
{ // yes
JOptionPane.showMessageDialog(null, "DEPOSIT INQUIRY \n AMOUNT DEPOSIT: "+ withdraw+ "\nPrinting Bank slip.....");
}
}
} while (a == Q);
}}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.