Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need this assignment done Must List: Starting code is this: Solution Dear, impor

ID: 3634288 • Letter: N

Question

Need this assignment done

Must List:

Starting code is this:

Explanation / Answer

Dear, import javax.swing.JOptionPane; class Practice6_1 { public static double newBalance=0; public static double balance=0; public static double adjustment=0; public static String response; public static String moreBankingBusiness; public static void main(String[] args) { try { moreBankingBusiness = JOptionPane.showInputDialog("do you want to do some banking?"); moreBankingBusiness=moreBankingBusiness.toUpperCase(); }catch (Exception e) { // Print out the exception that occurred System.out.println("Invalid Button Press - "+e.getMessage()); System.exit(0); } while(moreBankingBusiness.equals("YES")) { try { response=JOptionPane.showInputDialog ("What would you want to do ? 1.Deposit 2.Withdraw 3.GetBalance"); if(response.equals("")) { JOptionPane.showMessageDialog (null,"You nust make an entry in the InputBox."); System.exit(0); } if(response==null) { JOptionPane.showMessageDialog(null,"You clicled on the Cancel button."); System.exit(0); } int ch = Integer.parseInt(response); switch (ch) { case 1: deposit(); break; case 2: withdrawal(); break; case 3: balance(); break; default : JOptionPane.showMessageDialog(null,response+"is not vaild banking function"); break; } balance=newBalance; moreBankingBusiness=JOptionPane.showInputDialog("Do you have more banking business?"); moreBankingBusiness=moreBankingBusiness.toUpperCase(); }catch (Exception e) { // Print out the exception that occurred System.out.println("Invalid type of Input or Button Pressed - "+e.getMessage()); System.exit(0); } }//end of while } public static void deposit() { try { adjustment=Double.parseDouble(JOptionPane.showInputDialog("Enter the Deposit Amount")); newBalance=balance+adjustment; JOptionPane.showMessageDialog(null,"***SMILEY NATIONAL BANK*** "+ "Old Balance is:"+balance+" "+"Adjustment is :"+adjustment+" "+ "New Balance is:"+newBalance+" "); }catch (Exception e) { // Print out the exception that occurred System.out.println("Invalid operation - "+e.getMessage()); System.exit(0); } } public static void withdrawal() { try { adjustment=Double.parseDouble(JOptionPane.showInputDialog("Enter the Withdrawal Amount")); if (balance-adjustment>=0) { newBalance=balance-adjustment; JOptionPane.showMessageDialog (null,"***SMILEY NATIONAL BANK*** "+ "Old Balance is:"+balance+" "+ "Adjustment is :"+adjustment+" "+ "New Balance is:"+newBalance+" "); } else JOptionPane.showMessageDialog (null,"***SMILEY NATIONAL BANK*** "+ "Insufficient funds to withdraw."); }catch (Exception e) { // Print out the exception that occurred System.out.println("Invalid operation - "+e.getMessage()); System.exit(0); } } public static void balance() { JOptionPane.showMessageDialog(null,"***SMILEY NATIONAL BANK*** "+"Your Current Banace is:"+balance); } } Hope this would help you.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote