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

Problem Statement Design the classes for a banking program that simulates the op

ID: 3562715 • Letter: P

Question

Problem Statement

Design the classes for a banking program that simulates the operation of your local bank. It should have the following collection of classes.

Class Account

Data fields customer (type Customer), balance, accountNumber, transactions array (type Transaction []). Allocate an initial Transaction array of size 20, and provide a reallocate method that doubles the size of the Transaction array when it becomes full.

Methods: getBalance, getCustomer, toString, setCustomer

Class SavingsAccount

extends Account

Methods: deposit, withdraw, addInterest

Class Customer

Data fields: name, address, age, telephoneNumber, customerNumber

Methods: Accessors and modifiers1 for the data fields plus the additional abstract methods getSavingsInterest, getCheckInterest, and getCheckCharge.

Classes Senior, Adult, Student

All these classes extend Customer. Each has constant data fields SAVINGS_INTEREST, CHECK_INTEREST, CHECK_CHARGE, and OVERDRAFT_PENALTY that defines these values for customers of that type, and each class implements the corresponding accessors.

Class Bank

Data fields: accounts array (type Account[]. Allocate an array of size 100 and provide a reallocate method.

Methods: AddAccount, makeDeposit, makeWithdrawal., getAccount .

Class Transaction

Data fields: customerNumber, transactionType, amount, date and fees (a string describing unusual fees)

Methods: processTran.

This should be in Java language, and it is due on thursday. But would like answers promptly.

Explanation / Answer

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){} } } }
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