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

JAVA Create a menu-driven program using application to manage a bank account. It

ID: 3674118 • Letter: J

Question

JAVA

Create a menu-driven program using application to manage a bank account. It supports following operations:

Deposit money;

Withdraw money;

Check balance;

Add new account;

Delete account.

Application is driven by a text menu. Application stores the data in a .txt file. You must initial your .txt file with at least three accounts.

Data requirements:
It should have following attributes:

Account_no

Account_name

Balance

Note- use appropriate datatypes.

Required functionality: (User should be able to validate)

1. It should validate account_no to deposit money.
2. It should validate that, user cannot deposit negative amount.

3. It should validate account_no to withdraw money.

It should validate if amount to be withdrawn is less than the available funds in the account.

It should be able to add new account.

It should be able to delete existing account.

Finally, the menu should ask user to press key # to quit.

Remarks in program:

You must include remarks for every operations and attributes in your code.

Explanation / Answer

import java.io.*; class Curr_acct //CURRENT ACCOUNT CLASS { final int max_limit=20; final int min_limit=1; final double min_bal=500; private String name[]=new String[20]; privateint accNo[]=newint[20]; private String accType[]=new String[20]; privatedouble balAmt[]=newdouble[20]; staticint totRec=0; //Intializing Methodpublicvoid initialize() { for(int i=0;imax_limit) { System.out.println(" Sorry we cannot admit you in our bank... "); permit=false; } if(permit = true) //Allows to create new entry { totRec++; // Incrementing Total Record System.out.println(" =====RECORDING NEW ENTRY====="); try{ accNo[totRec]=totRec; //Created AutoNumber to accNo so no invalid id occurs System.out.println("Account Number : "+accNo[totRec]); BufferedReader obj = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter Name : "); System.out.flush(); name[totRec]=obj.readLine(); accType[totRec]="Current Account"; System.out.println("Account Type : "+accType[totRec]); do{ System.out.print("Enter Initial Amount to be deposited : "); System.out.flush(); str=obj.readLine(); balAmt[totRec]=Double.parseDouble(str); }while(balAmt[totRec]= min_bal) { balAmt[acno]=checkamt; //Displaying Depsit Details System.out.println(" After Updation..."); System.out.println("Account Number : "+acno); System.out.println("Balance Amount : "+balAmt[acno]+" "); } else { System.out.println(" Your Balance has gone down and so penalty is calculated"); //Bank policy is to charge 20% on total difference of balAmt and min_bal to be maintain penalty=((min_bal - checkamt)*20)/100; balAmt[acno]=balAmt[acno]-(amt+penalty); System.out.println("Now your balance revels : "+balAmt[acno]+" "); } } } catch(Exception e) {} } } class Sav_acct //SAVING ACCOUNT CLASS { final int max_limit=20; final int min_limit=1; final double min_bal=500; private String name[]=new String[20]; privateint accNo[]=newint[20]; private String accType[]=new String[20]; privatedouble balAmt[]=newdouble[20]; staticint totRec=0; //Intializing Methodpublicvoid initialize() { for(int i=0;imax_limit) { System.out.println(" Sorry we cannot admit you in our bank... "); permit=false; } if(permit = true) //Allows to create new entry { totRec++; // Incrementing Total Record System.out.println(" =====RECORDING NEW ENTRY====="); try{ accNo[totRec]=totRec; //Created AutoNumber to accNo so no invalid id occurs System.out.println("Account Number : "+accNo[totRec]); BufferedReader obj = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter Name : "); System.out.flush(); name[totRec]=obj.readLine(); accType[totRec]="Saving Account"; System.out.println("Account Type : "+accType[totRec]); do{ System.out.print("Enter Initial Amount to be deposited : "); System.out.flush(); str=obj.readLine(); balAmt[totRec]=Double.parseDouble(str); }while(balAmt[totRec]= min_bal) { balAmt[acno]=checkamt; //Displaying Depsit Details System.out.println(" After Updation..."); System.out.println("Account Number : "+acno); System.out.println("Balance Amount : "+balAmt[acno]+" "); } else { System.out.println(" As per Bank Rule you should maintain minimum balance of Rs 500 "); } } } catch(Exception e) {} } } class Bank_improved { publicstaticvoid main(String args[]) { String str; int choice,check_acct=1,quit=0; choice=0; Curr_acct curr_obj = new Curr_acct(); Sav_acct sav_obj = new Sav_acct(); System.out.println(" =====WELLCOME TO BANK DEMO PROJECT===== "); while( quit!=1) { try{ BufferedReader obj = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Type 1 for Current Account and Any no for Saving Account : "); System.out.flush(); str=obj.readLine(); check_acct=Integer.parseInt(str); } catch(Exception e) {} if(check_acct==1) { do//For Current Account { System.out.println(" Choose Your Choices ..."); System.out.println("1) New Record Entry "); System.out.println("2) Display Record Details "); System.out.println("3) Deposit..."); System.out.println("4) Withdraw..."); System.out.println("5) Quit"); System.out.print("Enter your choice : "); System.out.flush(); try{ BufferedReader obj = new BufferedReader(new InputStreamReader(System.in)); str=obj.readLine(); choice=Integer.parseInt(str); switch(choice) { case 1 : //New Record Entry curr_obj.newEntry(); break; case 2 : //Displaying Record Details curr_obj.display(); break; case 3 : //Deposit... curr_obj.deposit(); break; case 4 : //Withdraw... curr_obj.withdraw(); break; case 5 : System.out.println(" .....Closing Current Account....."); break; default : System.out.println(" Invalid Choice "); } } catch(Exception e) {} }while(choice!=5); } else { do//For Saving Account { System.out.println("Choose Your Choices ..."); System.out.println("1) New Record Entry "); System.out.println("2) Display Record Details "); System.out.println("3) Deposit..."); System.out.println("4) Withdraw..."); System.out.println("5) Quit"); System.out.print("Enter your choice : "); System.out.flush(); try{ BufferedReader obj = new BufferedReader(new InputStreamReader(System.in)); str=obj.readLine(); choice=Integer.parseInt(str); switch(choice) { case 1 : //New Record Entry sav_obj.newEntry(); break; case 2 : //Displaying Record Details sav_obj.display(); break; case 3 : //Deposit... sav_obj.deposit(); break; case 4 : //Withdraw... sav_obj.withdraw(); break; case 5 : System.out.println(" .....Closing Saving Account....."); break; default : System.out.println(" Invalid Choice "); } } catch(Exception e) {} }while(choice!=5); } try{ BufferedReader obj = new BufferedReader(new InputStreamReader(System.in)); System.out.print(" Enter 1 for Exit : "); System.out.flush(); str=obj.readLine(); quit=Integer.parseInt(str); }catch (Exception e){} } } }