Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.DataInputStream;
- import java.util.Scanner;
- import java.util.*;
- import java.io.PrintStream.*;
- /*class BankOperations performs all The operation required for Banking
- class BankOperations is inherited from class Info*/
- class BankOperations extends Info
- { /*Stores the Minimum balance i.e 500 default ( final double) */
- final double minBal = 500;
- int accNoGen;
- public int total_acc = 0;
- public Vector record = new Vector ( ) ;
- BankOperations ( )
- {
- pw = "";
- bal = "";
- current = "Current";
- savings = "Saving";
- }
- /*method newEntry : this method adds a new Entry ( Account in the list )*/
- void newEntry ( )
- {
- double temp;
- boolean valid = false;
- int type;
- record = new Vector ( );
- System.out.println ( "\n************************************************" );
- System.out.println ( "Enter Your Account Details" );
- try
- {
- Scanner src = new Scanner ( System.in );
- System.out.print ( "Enter Name : " );
- accName.add ( src.nextLine ( ) );
- System.out.print ( "Enter a 6 digit Account Number Of Your Choice : " );
- accNoGen = src.nextInt ( );
- if ( ( ( accNoGen / 100000 ) < 1.0 ) || ( ( accNoGen / 100000 ) > 9 ) )
- {
- System.out.println ( "Invalid Account Number\nAccount Number Is Not 6 Digit Number" );
- accName.remove ( accName.size ( ) - 1 );
- newEntry ( );
- return;
- }
- if ( total_acc != 0 )
- valid = validator ( accNoGen );
- if ( valid == true )
- {
- System.out.println ( "\nSorry, This Account Number Already Exist, Try Another One" );
- accName.remove ( accName.size ( ) - 1 );
- newEntry ( );
- }
- else
- {
- accNo.add ( accNoGen );
- System.out.print ( "Please See That No one Is Beside You While Entering The New Password !!!!!\nEnter New Password : " );
- pw=src.next ( );
- accPword.add ( pw );
- System.out.println ( "Account Type : " );
- System.out.println ( "\t1.Current\n\t2.Savings" );
- System.out.print ( "Enter your account Type : " );
- type = 0;
- do
- {
- type = src.nextInt ( );
- if ( type == 1 )
- {
- accType.add ( current );
- break;
- }
- else if ( type == 2 )
- {
- accType.add ( savings );
- break;
- }
- else
- {
- System.out.println ( "Invalid Account Type. Try Again" );
- type = 0;
- }
- }while ( type == 0 );
- do
- {
- System.out.print ( "-Enter Initial Amount to be deposited : " );
- temp = src.nextDouble ( );
- System.out.print ( "Enter The Amount to be deposited Again : " );
- bal = src.next ( );
- if ( temp < minBal )
- System.out.println ( "----------Enter Initial Amount must be more or equal to Rs.500 " );
- else
- {
- accBal.add ( temp );
- record.add ( temp );
- balRecord.add ( record );
- }
- }while ( temp < minBal );
- total_acc++;
- clear ( );
- System.out.println ( "\nAccount Created Successfuly" );
- System.out.println ( "************************************************" );
- System.out.println ( "\n" );
- }
- }catch ( Exception e )
- {
- errorDisplay ( e );
- }
- }
- /*This Method Display the details of Account */
- void Display ( ){
- boolean valid;
- System.out.println ( "\n************************************************" );
- System.out.println ( "=====DISPLAYING DETAILS OF CUSTOMER=====\n" );
- try
- {
- Scanner src = new Scanner ( System.in );
- System.out.print ( "Enter Your Account Number : " );
- int accNoInput = src.nextInt ( );
- System.out.println ( "Please See That No one Is Beside You While Entering The Password !!!!!" );
- System.out.print ( "Enter Your Password : " );
- String pw = src.next ( );
- clear ( );
- valid = validator ( accNoInput );
- if ( valid == true )
- {
- int index = accNo.indexOf ( accNoInput );
- boolean validp = validatorP ( pw,index );
- if ( validp == true )
- {
- System.out.println ( "Account Number : " + accNo.get ( index ) );
- System.out.println ( "Account Name : " + accName.get ( index ) );
- System.out.printf ( "Account Balance: %.2f\n",+accBal.get ( index ) );
- System.out.println ( "Account Balance In Words : " );
- displayword ( ( int )Math.round ( accBal.get ( index ) ) );
- System.out.print ( " Rs " );
- int n = num ( bal );
- if ( n != 0 )
- {
- displayword ( n );
- System.out.println ( "Paise " );
- }
- System.out.println ( "\nAccount Type : " + accType.get ( index ) );
- if ( accType.get ( index ) == "Current" )
- System.out.println ( "Cheque Facility : Yes" );
- else
- System.out.println ( "Cheque Facility : No" );
- }
- else
- System.out.println ( "\nIncorrect Password" );
- }
- else
- System.out.println ( "\nInvalid Account Number\n" );
- System.out.println ( "\n************************************************" );
- System.out.println ( "\n" );
- }catch ( Exception e )
- {
- System.out.println ( e );
- errorDisplay ( e );
- }
- }
- /*Boolean validator is a class the accepts and input i.e. Account Number
- the checks if the entered input is zero then it returns false
- else if entered Input is non zero then it compares the input with
- the accounts Number which are already present if found it return True else
- it return false
- @param accNoInput
- @return true or false*/
- boolean validator ( int accNoInput )
- {
- if ( accNoInput == 0 )
- return false;
- boolean valid = accNo.contains ( accNoInput );
- return valid;
- }
- /* Boolean validatorP method checks the given password
- if it exist with correct accNo then it returns true
- else it returns false*/
- boolean validatorP ( String pw,int index )
- {
- if ( pw.equals ( accPword.get ( index ) ) )
- return true;
- return false;
- }
- /*This method helps to withdraw specific amount from the Account limited to minimum Balance */
- void Withdraw ( )
- {
- boolean valid;
- System.out.println ( "\n************************************************" );
- System.out.println ( "=====WITHDRAW AMOUNT=====" );
- try
- {
- Scanner src = new Scanner ( System.in );
- System.out.print ( "Enter Your Acount Number : " );
- int accNoInput = src.nextInt ( );
- System.out.println ( "Please See That No one Is Beside You While Entering The Password !!!!!" );
- System.out.print ( "Enter Your Password : " );
- String pw = src.next ( );
- clear ( );
- valid = validator ( accNoInput );
- if ( valid == true )
- {
- int index = accNo.indexOf ( accNoInput );
- boolean validp = validatorP ( pw,index );
- if ( validp == true )
- {
- System.out.println ( "Account Number : "+accNo.get ( index ) );
- System.out.printf ( "Account Balance: %.2f\n",accBal.get ( index ) );
- System.out.printf ( "Account Balance In Words : " );
- displayword ( ( int )Math.round ( accBal.get ( index ) ) );
- System.out.print ( " Rs " );
- int n = num ( bal );
- if ( n != 0 )
- {
- displayword ( n );
- System.out.println ( "Paise " );
- }
- System.out.print ( "Enter Amount you want to withdraw : " );
- double amt = src.nextDouble ( );
- double checkamt = accBal.get ( index ) - amt;
- if ( checkamt < minBal )
- System.out.println ( "\n\nAs per Bank Rule you should maintain minimum balance of Rs 500" );
- else
- {
- amt=amt * ( -1 );
- record = balRecord.elementAt ( index );
- record.add ( amt );
- accBal.set ( index, checkamt );
- System.out.println ( "\nAfter Updation..." );
- System.out.println ( "Account Number : " + accNo.get ( index ) );
- System.out.printf ( "Account Balance: %.2f\n",+accBal.get ( index ) );
- System.out.printf ( "Account Balance In Words : " );
- displayword ( ( int )Math.round ( accBal.get ( index ) ) );
- System.out.print ( " Rs " );
- n = num ( bal );
- if ( n != 0 )
- {
- displayword ( n );
- System.out.println ( "Paise " );
- }
- }
- }
- else
- System.out.println ( "\nIncorrect Password" );
- }
- else
- System.out.println ( "\nInvalid Account Number\n" );
- System.out.println ( "************************************************" );
- System.out.println ( "\n\n" );
- }catch ( Exception e )
- {
- errorDisplay ( e );
- }
- }
- /*This Method Helps to deposit specific amount in the account limited to the Range of Integer value */
- void Deposite ( )
- {
- boolean valid;
- System.out.println ( "************************************************" );
- System.out.println ( "=====DEPOSIT AMOUNT=====\n" );
- try
- {
- Scanner src = new Scanner ( System.in );
- System.out.print ( "Enter Your Acount Number : " );
- int accNoInput = src.nextInt ( );
- System.out.println ( "Please See That No one Is Beside You While Entering The Password !!!!!" );
- System.out.print ( "Enter Your Password : " );
- String pw = src.next ( );
- clear ( );
- valid = validator ( accNoInput );
- if ( valid == true )
- {
- int index = accNo.indexOf ( accNoInput );
- boolean validp = validatorP ( pw , index );
- if ( validp == true )
- {
- System.out.println ( "Account Number : " + accNo.get ( index ) );
- System.out.printf ( "Account Balance: %.2f\n", + accBal.get ( index ) );
- System.out.print ( "Account Balance In Words : " );
- displayword ( ( int ) Math.round ( accBal.get ( index ) ) );
- System.out.print ( " Rs " );
- int n = num ( bal );
- if ( n != 0 )
- {
- displayword ( n );
- System.out.println ( "Paise " );
- }
- System.out.print ( "Enter Amount you want to Deposit : " );
- double amt = src.nextDouble( );
- double depamt = amt + accBal.get( index );
- accBal.set( index , depamt );
- record = balRecord.elementAt( index );
- record.add( amt );
- System.out.println ( "\nAfter Updation...");
- System.out.println ( "Account Number : " + accNo.get ( index ) );
- System.out.printf ( "Account Balance: %.2f\n",+accBal.get ( index ) );
- System.out.printf ( "Account Balance In Words : ");
- displayword ( ( int ) Math.round ( accBal.get ( index ) ) );
- System.out.print ( " Rs " );
- n = num ( bal );
- if( n != 0 )
- {
- displayword ( n );
- System.out.println ( "Paise " );
- }
- }
- else
- System.out.println ( "\nIncorrect Password" );
- }
- else
- System.out.println ( "\nInvalid Account Number" );
- System.out.println ( "************************************************" );
- System.out.println ( "\n" );
- }catch( Exception e )
- {
- errorDisplay( e );
- }
- }
- void balRecord()
- {
- boolean valid;
- System.out.println( "************************************************" );
- System.out.println( "=====BALANCE RECORD=====\n" );
- try
- {
- Scanner src = new Scanner( System.in );
- System.out.print ( "Enter Your Acount Number : " );
- int accNoInput = src.nextInt ( );
- System.out.println ( "Please See That No one Is Beside You While Entering The Password !!!!!" );
- System.out.print ( "Enter Your Password : " );
- String pw = src.next ( );
- clear ( );
- valid = validator ( accNoInput ) ;
- if( valid == true )
- {
- int index = accNo.indexOf ( accNoInput );
- boolean validp = validatorP ( pw,index );
- if( validp == true )
- {
- record = balRecord.elementAt( index );
- System.out.println ("Note : \nFor Withdrawal Value Signed With '-' \nFor Deposit Value Unsigned ");
- for( int i = 0 ; i < record.size() ; i++ )
- System.out.println ( ( i + 1 ) + ") Rs " + record.elementAt ( i ) );
- System.out.printf ("Account Balance: %.2f\n", + accBal.get ( index ) );
- System.out.printf ("Account Balance In Words : ");
- displayword ( ( int ) Math.round ( accBal.get ( index ) ) );
- System.out.print ( " Rs " );
- int n = num ( bal );
- if( n != 0 )
- {
- displayword ( n );
- System.out.println ( "Paise " );
- }
- }
- else
- System.out.println ("Incorrect Password" );
- }
- else
- System.out.println ( "Invalid Account Number" );
- System.out.println ( "************************************************" );
- System.out.println ( "\n" );
- }catch ( Exception e )
- {
- errorDisplay ( e );
- }
- }
- /*This account helps to delete an account from already present account */
- void delete ( )
- {
- boolean valid;
- System.out.println ( "************************************************" );
- System.out.println ( "=====DELETE ACCOUNT=====" );
- try
- {
- Scanner src = new Scanner ( System.in );
- System.out.print ( "Enter Your Account Number : " );
- int accNoInput = src.nextInt();
- System.out.println ( "Please See That No one Is Beside You While Entering The Password !!!!!" );
- System.out.print ( "Enter Your Password : " );
- String pw = src.next ( );
- clear ( );
- valid = validator ( accNoInput );
- if ( valid == true )
- {
- int index = accNo.indexOf ( accNoInput );
- boolean validp = validatorP ( pw,index );
- if ( validp == true )
- {
- accNo.remove ( index );
- accName.remove ( index );
- accType.remove ( index );
- accBal.remove ( index );
- accPword.remove ( index );
- balRecord.remove ( index );
- System.out.println ( "\nAccount No : " + accNoInput+ " deleted Successfuly" );
- }
- else
- System.out.println ( "\nIncorrect Password" );
- }
- else
- System.out.println ( "\nInvalid Account Number" );
- System.out.println ( "************************************************" );
- System.out.println ( "\n" );
- }catch ( Exception e )
- {
- errorDisplay ( e );
- }
- }
- /*this method Modify the name of the Account holder when entered a valid account Number*/
- void modifyAcc ( )
- {
- boolean valid;
- System.out.println ( "************************************************" );
- System.out.println ( "=====MODIFY ACCOUNT=====" );
- try
- {
- DataInputStream in = new DataInputStream ( System.in );
- System.out.print ( "Enter Your Account Number : " );
- int accNoInput = Integer.parseInt ( in.readLine ( ) );
- System.out.println ( "Please See That No one Is Beside You While Entering The Password !!!!!" );
- System.out.print ( "Enter Your Password : " );
- String pw = in.readLine ( );
- clear ( );
- valid = validator ( accNoInput );
- if ( valid == true )
- {
- int index = accNo.indexOf ( accNoInput );
- boolean validp = validatorP ( pw , index );
- if ( validp == true )
- {
- System.out.print ( "1) Change Name\n2) Change Password\n3) Both\nEnter Your Choice : " );
- int c = Integer.parseInt ( in.readLine ( ) );
- switch ( c )
- {
- case 1:
- System.out.println ( "Old Account Name : " + accName.get ( index ) );
- System.out.print ( "Enter Your New Account Name : " );
- String str = in.readLine ( );
- accName.set ( index , str );
- clear ( );
- System.out.println ( "Account Name Modified" );
- break;
- case 2:
- System.out.println ( "Old Password Name : " + accPword.get ( index ) );
- System.out.println ( "Please See That No one Is Beside You While Entering The New Password !!!!!" );
- System.out.print ( "Enter Your New Account Password : " );
- pw = in.readLine ( );
- accPword.set ( index , pw );
- clear ( );
- System.out.println ( "Account Password Modified" );
- break;
- case 3:
- System.out.println ( "Old Account Name : " + accName.get ( index ) );
- System.out.print ( "Enter Your New Account Name : " );
- str = in.readLine ( );
- accName.set ( index , str );
- System.out.println ( "Old Password Name : " + accPword.get ( index ) );
- System.out.println ( "Please See That No one Is Beside You While Entering The New Password !!!!!" );
- System.out.print ( "Enter Your New Account Password : " );
- pw = in.readLine ( );
- accPword.set ( index , pw );
- clear ( );
- System.out.println ( "Account Name & Password Modified" );
- break;
- default :
- System.out.println ( "Invalid Input" );
- break;
- }
- }
- else
- System.out.println ( "\nIncorrect Password" );
- }
- else
- System.out.println ( "\nInvalid Account Number" );
- System.out.println ( "\n************************************************" );
- System.out.println ( "\n" );
- }catch ( Exception e )
- {
- errorDisplay ( e );
- }
- }
- void DisplayBal ( )
- {
- boolean valid;
- System.out.println ( "\n************************************************" );
- System.out.println ( "=====DISPLAYING BALANCE OF CUSTOMER=====\n" );
- try
- {
- Scanner src = new Scanner ( System.in );
- System.out.print ( "Enter Your Account Number : " );
- int accNoInput = src.nextInt ( );
- System.out.println ( "Please See That No one Is Beside You While Entering The Password !!!!!" );
- System.out.print ( "Enter Your Password : " );
- String pw = src.next ( );
- clear ( );
- valid = validator ( accNoInput );
- if ( valid == true )
- {
- int index = accNo.indexOf ( accNoInput );
- boolean validp = validatorP ( pw , index );
- if ( validp == true )
- {
- System.out.println ( "Account Number : " + accNo.get ( index ) );
- System.out.printf ( "Account Balance: Rs. %.2f\n",accBal.get ( index ) );
- displayword ( ( int)Math.round ( accBal.get ( index ) ) );
- System.out.print ( " Rs " );
- int n = num ( bal );
- if ( n != 0 )
- {
- displayword ( n );
- System.out.println ( "Paise " );
- }
- }
- else
- System.out.println ( "\nIncorrect Password" );
- }
- else
- System.out.println ( "\nInvalid Account Number\n" );
- System.out.println ( "\n************************************************" );
- System.out.println ( "\n" );
- }catch ( Exception e )
- {
- errorDisplay ( e );
- }
- }
- public void balTrans ( )
- {
- boolean valid1,valid2,validp;
- System.out.println ( "\n************************************************" );
- System.out.println ( "=====BALANCE TRANSFER=====\n" );
- try
- {
- Scanner src = new Scanner ( System.in );
- System.out.print ( "Enter Your Account Number : " );
- int accNoInput1 = src.nextInt ( );
- System.out.println ( "Please See That No one Is Beside You While Entering The Password !!!!!" );
- System.out.print ( "Enter Your Password : " );
- String pw = src.next ( );
- int index1 = accNo.indexOf ( accNoInput1 );
- validp = validatorP ( pw , index1 );
- clear ( );
- System.out.print ( "Enter Account Number Of Destination : " );
- int accNoInput2 = src.nextInt ( );
- valid1 = validator ( accNoInput1 );
- valid2 = validator ( accNoInput2 );
- if ( valid1 == true && validp == true )
- {
- if ( valid2 == true )
- {
- int index2 = accNo.indexOf ( accNoInput2 );
- record = balRecord.elementAt ( index1 );
- Vector record2 = new Vector ( );
- record2 = balRecord.elementAt ( index2 );
- System.out.println ( "Balance : " +accBal.get ( index1 ) );
- System.out.print ( "Amount To Be Transfered : " );
- double amt = src.nextDouble ( );
- double checkamt = accBal.get ( index1 ) - amt;
- if ( checkamt < minBal )
- System.out.println ( "\n\nAs per Bank Rule you should maintain minimum balance of Rs 500" );
- else
- {
- accBal.set ( index1 , checkamt );
- record.add ( ( -1 ) * amt );
- record2.add ( amt );
- amt = accBal.get ( index2 ) + amt;
- accBal.set ( index2 , amt );
- System.out.println ( "\nAfter Updation..." );
- System.out.println ( "Account Number : " + accNo.get ( index1 ) );
- System.out.printf ( "Account Balance : %.2f\n",accBal.get ( index1 ) );
- System.out.printf ( "Account Balance In Words : " );
- displayword ( ( int)Math.round ( accBal.get ( index1 ) ) );
- System.out.print ( " Rs " );
- int n = num ( bal );
- if ( n != 0 )
- {
- displayword ( n );
- System.out.println ( "Paise " );
- }
- }
- }
- else
- System.out.println ( "Invalid Destination Acount Number" );
- }
- else
- System.out.println ( "\nInvalid Source Account Number or Incorrect Password\n" );
- System.out.println ( "************************************************" );
- System.out.println ( "\n\n" );
- }catch ( Exception e )
- {
- errorDisplay ( e );
- }
- }
- /* num method is to get the the two nos after decimal pt */
- public static int num ( String bal )
- {
- int n = bal.indexOf ( ".");
- if ( n == -1 )
- return 0;
- String s1 = bal.substring ( 0 , n );
- String s2 = bal.substring ( n+1 , bal.length ( ) );
- char s3 [] = new char[ s2.length ( ) ];
- s3 = s2.toCharArray ( );
- int number;
- if( s3[ 0 ] != '0' && s3[ 1 ] != '0')
- number = 10* ( ( int ) s3[ 0 ] - 48 )+ ( ( int ) s3[ 1 ] - 48 );
- else
- number = 0;
- return number;
- }
- /* word method is to get the balance in words*/
- public static String word ( int num )
- {
- int n2 = num / 10;
- String sf = "";
- if ( num >= 10 & num < 20 )
- {
- switch ( num )
- {
- case 10:
- sf = "Ten";
- break;
- case 11:
- sf = "Eleven";
- break;
- case 12:
- sf = "Twelve";
- break;
- case 13:
- sf = "Thirteen";
- break;
- case 14:
- sf = "Fourteen";
- break;
- case 15:
- sf = "Fifteen";
- break;
- case 16:
- sf = "Sixteen";
- break;
- case 17:
- sf = "Seventeen";
- break;
- case 18:
- sf = "Eighteen";
- break;
- case 19:
- sf = "Nineteen";
- break;
- }
- return sf;
- }
- if ( n2 >= 2 && n2 <= 9 )
- {
- switch ( n2 )
- {
- case 2:
- sf = " Twenty";
- break;
- case 3:
- sf = " Thirty";
- break;
- case 4:
- sf = " Fourty";
- break;
- case 5:
- sf = " Fifty";
- break;
- case 6:
- sf = " Sixty";
- break;
- case 7:
- sf = " Seventy";
- break;
- case 8:
- sf = " Eighty";
- break;
- case 9:
- sf = " Ninety";
- break;
- }
- }
- num = num % 10;
- switch ( num )
- {
- case 1:
- sf = sf + " One ";
- break;
- case 2:
- sf = sf + " Two ";
- break;
- case 3:
- sf = sf + " Three ";
- break;
- case 4:
- sf = sf + " Four ";
- break;
- case 5:
- sf = sf + " Five ";
- break;
- case 6:
- sf = sf + " Six ";
- break;
- case 7:
- sf = sf + " Seven ";
- break;
- case 8:
- sf = sf + " Eight ";
- break;
- case 9:
- sf = sf + " Nine ";
- break;
- }
- return sf;
- }
- /* displayword method returns the balance in words*/
- public static void displayword ( int n )
- {
- int crore,lakh,th,hun;
- String sc,sl,sth,shun,sf = "";
- if ( n / 10000000 >= 1 )
- {
- crore = n / 10000000;
- sc = word ( crore );
- System.out.print ( sc + " Crore " );
- n = n % 10000000;
- }
- if ( n / 100000 >= 1 )
- {
- lakh = n / 100000;
- sl = word ( lakh );
- System.out.print ( sl + "Lakhs " );
- n = n % 100000;
- }
- if ( n / 1000 >= 1 )
- {
- th = n / 1000;
- sth = word ( th );
- System.out.print ( sth + "Thousands" );
- n = n % 1000;
- }
- if ( n /100 >= 1 )
- {
- hun = n / 100;
- shun = word ( hun );
- System.out.print ( shun + "Hundred " );
- n = n % 100;
- }
- if ( n != 0)
- {
- System.out.print ( "and " );
- sf = word ( n );
- }
- System.out.print ( sf );
- }
- void errorDisplay ( Exception e )
- {
- System.out.println ( "\n ******Warning****** " );
- System.out.println ( "\nThere was an Technical Error while Creating " );
- System.out.println ( "your account due to Mismatched Values you have" );
- System.out.println ( "Entered .'Its not My Fault...!!!!!'" );
- System.out.println ( "************************************************\n" );
- }
- void clear ( )
- {
- for ( int i = 0 ; i < 620 ; i++ )
- System.out.println ( "\b" );
- }
- }
- /*class Info Contains Elements Required for storing User entered values */
- class Info
- {
- /*accName : Stores the Name of Account ( String)*/
- public Vector < String > accName = new Vector < String > ( ) ;
- /*accNo : Stores the Account Number ( Integer)*/
- public Vector < Integer > accNo = new Vector < Integer > ( );
- /*accPword : Stores Password Of The Account */
- public Vector < String > accPword = new Vector < String > ( ) ;
- /*accType : Stores Account Type ( Current / Savings) ( String)*/
- public Vector < String > accType = new Vector < String > ( ) ;
- /*accBal : Stores the Account Balance ( Double)*/
- public Vector < Double > accBal = new Vector < Double > ( );
- /*balRecord : stores the balance history / record ( Vector ) */
- public Vector < Vector > balRecord = new Vector < Vector > ( );
- String pw = new String ( );
- String bal = new String ( );
- String current = new String ( );
- String savings = new String ( );
- }
- /*This is the Main Class*/
- public class MainBank
- {
- public static void main ( String args [] )
- {
- int choice = 0;
- //BO_obj is the object Created for Accessing BankOperations Class
- BankOperations BO_obj = new BankOperations ( );
- do
- {
- System.out.println ( "|============================================|" );
- System.out.println ( "| WELCOME TO RIZVI's BANK |" );
- System.out.println ( "|============================================|" );
- System.out.println ( "|********... Select Your Choices ...*********|" );
- System.out.println ( "| |" );
- System.out.println ( "| 1) New Record Entry |" );
- System.out.println ( "| 2) Display Record Details |" );
- System.out.println ( "| 3) Display Bal |" );
- System.out.println ( "| 4) Deposit |" );
- System.out.println ( "| 5) Withdraw |" );
- System.out.println ( "| 6) Modify |" );
- System.out.println ( "| 7) Balance Transfer |" );
- System.out.println ( "| 8) Balance Record |" );
- System.out.println ( "| 9) Delete |" );
- System.out.println ( "| 10) Exit |" );
- System.out.println ( "|********************************************|" );
- System.out.print ( "Enter your choice : " );
- Scanner src = new Scanner ( System.in );
- try
- {
- choice = src.nextInt ( );
- System.out.println ( "\n" );
- switch ( choice )
- {
- case 1:
- BO_obj.newEntry ( );
- break;
- case 2:
- BO_obj.Display ( );
- break;
- case 3:
- BO_obj.DisplayBal ( );
- break;
- case 4:
- BO_obj.Deposite ( );
- break;
- case 5:
- BO_obj.Withdraw ( );
- break;
- case 6:
- BO_obj.modifyAcc ( );
- break;
- case 7:
- BO_obj.balTrans ( );
- break;
- case 8:
- BO_obj.balRecord ( );
- break;
- case 9:
- BO_obj.delete ( );
- break;
- case 10:
- System.out.println ( "\n*********Thankyou For visiting**********" );
- break;
- }
- }catch ( Exception e )
- {
- System.out.println ( "\nWrong Entry! Wrong Entry! Wrong Entry!\n\n" );
- }
- }while ( choice != 10 );
- }
- }
Add Comment
Please, Sign In to add comment