Associate
Can't get my head round this. It's either a typo or a problem, can anybody have a look.
import javax.swing.JOptionPane;
public class classpractice7_1 {
public static void main(String[] args) {
String response;
String moreBankingBusiness;
moreBankingBusiness = JOptionPane.showInputDialog
( "Do you want to do some banking?" );
moreBankingBusiness = moreBankingBusiness.toUpperCase();
while (moreBankingBusiness.equals ("YES")){
response = JOptionPane.showInputDialog
( "What would you like to do?" +
"(1=Deposit, 2=Withdraw, 3=Get Balance)");
if (response == null)
{
JOptionPane.showMessageDialog
(null, "You clicked on the Cancel Button");
System.exit (0);
}
else
if (response.equals(""))
{
JOptionPane.showMessageDialog
(null, "You must make an entry in the InputBox");
System.exit (0);
}
else
if (Integer.parseInt(response) < 1 | Integer.parseInt(response) > 3)
{
JOptionPane.showMessageDialog
(null, response + " - is not a valid student type");
System.exit (0);
}
if (Integer.parseInt (response) == 1){
BankTransaction transaction = new BankTransaction();
transaction.makeDeposit();
}
if (Integer.parseInt (response) == 2){
BankTransaction transaction = new BankTransaction();
transaction.makeWithdrawal();
}
if (Integer.parseInt (response) == 3){
BankTransaction transaction = new BankTransaction();
transaction.getBalance();
}
moreBankingBusiness = JOptionPane.showInputDialog
( "Do you have more banking business?" );
moreBankingBusiness= moreBankingBusiness.toUpperCase();
} // end of while
JOptionPane.showMessageDialog
(null, "Thanks for banking with us!");
}
}
import javax.swing.JOptionPane;
public class classpractice7_1 {
public static void main(String[] args) {
String response;
String moreBankingBusiness;
moreBankingBusiness = JOptionPane.showInputDialog
( "Do you want to do some banking?" );
moreBankingBusiness = moreBankingBusiness.toUpperCase();
while (moreBankingBusiness.equals ("YES")){
response = JOptionPane.showInputDialog
( "What would you like to do?" +
"(1=Deposit, 2=Withdraw, 3=Get Balance)");
if (response == null)
{
JOptionPane.showMessageDialog
(null, "You clicked on the Cancel Button");
System.exit (0);
}
else
if (response.equals(""))
{
JOptionPane.showMessageDialog
(null, "You must make an entry in the InputBox");
System.exit (0);
}
else
if (Integer.parseInt(response) < 1 | Integer.parseInt(response) > 3)
{
JOptionPane.showMessageDialog
(null, response + " - is not a valid student type");
System.exit (0);
}
if (Integer.parseInt (response) == 1){
BankTransaction transaction = new BankTransaction();
transaction.makeDeposit();
}
if (Integer.parseInt (response) == 2){
BankTransaction transaction = new BankTransaction();
transaction.makeWithdrawal();
}
if (Integer.parseInt (response) == 3){
BankTransaction transaction = new BankTransaction();
transaction.getBalance();
}
moreBankingBusiness = JOptionPane.showInputDialog
( "Do you have more banking business?" );
moreBankingBusiness= moreBankingBusiness.toUpperCase();
} // end of while
JOptionPane.showMessageDialog
(null, "Thanks for banking with us!");
}
}