Question
java

Data Structures (CIS M. Lowenthal ASSIGNMENT1-BEVIEW The ABC Hardware Company has hired you to wrte a program for Its Accou
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#Java Program For Bank Management System :-

This java program has following main menus:

  1. Display All
  2. Search By Account
  3. Deposit
  4. Withdrawal
  5. Exit
#Program:-
import java.util.Scanner;
class Bank
{
        private String accno;
        private String name;
        private long balance;

        Scanner KB=new Scanner(System.in);
        //method to open an account
        void openAccount()
        { 
                System.out.print("Enter Account No: ");
                accno=KB.next();
                System.out.print("Enter Name: ");
                name=KB.next();
                System.out.print("Enter Balance: ");
                balance=KB.nextLong();
        }

        //method to display account details
        void showAccount()
        { 
                System.out.println(accno+","+name+","+balance);
        }

        //method to deposit money
        void deposit()
        {
                long amt;
                System.out.println("Enter Amount U Want to Deposit : ");
                amt=KB.nextLong();
                balance=balance+amt;
        }

        //method to withdraw money
        void withdrawal()
        {
                long amt;
                System.out.println("Enter Amount U Want to withdraw : ");
                amt=KB.nextLong();
                if(balance>=amt)
                { 
                        balance=balance-amt;
                }
                else
                {
                        System.out.println("Less Balance..Transaction Failed..");
                }
        }

        //method to search an account number
        boolean search(String acn)
        { 
                if(accno.equals(acn))
                { 
                        showAccount();
                        return(true);
                }
                return(false);
        }
}

class ExBank
{  
        public static void main(String arg[])
        {
                Scanner KB=new Scanner(System.in);
                
                //create initial accounts
                System.out.print("How Many Customer U Want to Input : ");
                int n=KB.nextInt();
                Bank  C[]=new Bank[n];
                for(int i=0;i<C.length;i++)
                {   
                        C[i]=new Bank();
                        C[i].openAccount();
                }
                
                //run loop until menu 5 is not pressed
                int ch;
                do
                {
                        System.out.println("Main Menu\n
                        1.Display All\n
                        2.Search By Account\n
                        3.Deposit\n
                        4.Withdrawal\n
                        5.Exit");
                        System.out.println("Ur Choice :");
                        ch=KB.nextInt();
                        switch(ch)
                        { 
                                case 1:
                                        for(int i=0;i<C.length;i++)
                                        {
                                                C[i].showAccount();
                                        }
                                        break;

                                case 2:
                                        System.out.print("Enter Account No U Want to Search...: ");
                                        String acn=KB.next();
                                        boolean found=false;
                                        for(int i=0;i<C.length;i++)
                                        {  
                                                found=C[i].search(acn);
                                                if(found)
                                                {
                                                        break;
                                                }
                                        }
                                        if(!found)
                                        {
                                                System.out.println("Search Failed..Account Not Exist..");
                                        }
                                        break;

                                case 3:
                                        System.out.print("Enter Account No : ");
                                        acn=KB.next();
                                        found=false;
                                        for(int i=0;i<C.length;i++)
                                        {  
                                                found=C[i].search(acn);
                                                if(found)
                                                {
                                                        C[i].deposit();
                                                        break;
                                                }
                                        }
                                        if(!found)
                                        {
                                                System.out.println("Search Failed..Account Not Exist..");
                                        }
                                        break;

                                case 4:
                                        System.out.print("Enter Account No : ");
                                        acn=KB.next();
                                        found=false;
                                        for(int i=0;i<C.length;i++)
                                        {  
                                                found=C[i].search(acn);
                                                if(found)
                                                {
                                                        C[i].withdrawal();
                                                        break;
                                                }
                                        }
                                        if(!found)
                                        {
                                                System.out.println("Search Failed..Account Not Exist..");
                                        }
                                        break;

                                case 5:
                                        System.out.println("Good Bye..");
                                        break;
                        }
                }
                while(ch!=5);
        }
}

#Note:- Hope this program is useful for you.

Add a comment
Know the answer?
Add Answer to:
java Data Structures (CIS M. Lowenthal ASSIGNMENT1-BEVIEW The "ABC Hardware Company has hired you to wrte...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • THE PROBLEM: The nice folks from the Lion Lending Company have hired you to write some...

    THE PROBLEM: The nice folks from the Lion Lending Company have hired you to write some software that will process their daily loan information. The data will come from a text file that has the following format: The first line will contain an integer: number of loan applications There will be two rows for each of the customers First line will be the customer's (1) first name and (2) last name, separated by a space (assume there is no spaces...

  • Modify your program from Assignment # 7 part b (see below for code) by creating an...

    Modify your program from Assignment # 7 part b (see below for code) by creating an interactive GUI application that displays the list of the orders read in from the file (create a data file using your CreateBankFile.java program which has a least 10 bank account records in it and include it with your submission) and the total number of bank accounts. When your program starts it will first read the records from the Bank Account file (AccountRecords.txt) and creates...

  • Using: C# Inventory Management System Objective: Work with multiple objects and reading data files. Description: A...

    Using: C# Inventory Management System Objective: Work with multiple objects and reading data files. Description: A wholesale distributor has six warehouses (Atlanta, Baltimore, Chicago, Denver, Ely and Fargo) and sells five different items (identified by part number: 102, 215, 410, 525 and 711). Each warehouse may stock any or all of the five items. The company buys and sells these items constantly. Company transaction records contain a transaction code (‘P’ for a purchase or ‘S’ for a sale) followed by...

  • write a code on .C file Problem Write a C program to implement a banking application...

    write a code on .C file Problem Write a C program to implement a banking application system. The program design must use a main and the below functions only. The program should use the below three text files that contain a set of lines. Sample data of these files are provided with the assessment. Note that you cannot use the library string.h to manipulate string variables. For the file operations and manipulations, you can use only the following functions: fopen(),...

  • Java Data Structures

    Programming Instructions:Using      Java Object Oriented Principles, write a program which produces the      code as indicated in the following specifications: Your       program must be a console application that provides a user this exact       menu:Please select one of the following:1: Add Client to Bank2: Display Clients in the Bank3: Set Bank Name4: Search for a Client5: Exit Enter your Selection: <keyboard input here> The       menu must be displayed repeatedly until 5...

  • Customer Accounts This program should be designed and written by a team of students. Here are...

    Customer Accounts This program should be designed and written by a team of students. Here are some suggestions: Write a program that uses a structure to store the following information about a customer account: • Name • Address • City, state, and ZIP • Telephone number • Account balance • Date of last payment The structure should be used to store customer account records in a file. The program should have a menu that lets the user perform the following...

  • Write a program that can read XML files for customer accounts receivable, such as <ar>        <customerAccounts>...

    Write a program that can read XML files for customer accounts receivable, such as <ar>        <customerAccounts>               <customerAccount>                       <name>Apple County Grocery</name>                       <accountNumber>1001</accountNumber>                       <balance>1565.99</balance>               </customerAccount>               <customerAccount>                       <name>Uptown Grill</name>                       <accountNumber>1002</accountNumber>                       <balance>875.20</balance>               </customerAccount>        </customerAccounts>        <transactions>               <payment>                       <accountNumber>1002</accountNumber>                       <amount>875.20</amount>               </payment>               <purchase>                       <accountNumber>1002</accountNumber>                       <amount>400.00</amount>               </purchase>               <purchase>                       <accountNumber>1001</accountNumber>                       <amount>99.99</amount>               </purchase>               <payment>                       <accountNumber>1001</accountNumber>                       <amount>1465.98</amount>               </payment>        </transactions>     </ar> Your program should construct an CustomerAccountsParser object, parse the XML data & create new CustomerAccount objects in the CustomerAccountsParser for each of the products the XML data, execute all of...

  • For this program, you will be working with data from the NASA website which lists Near...

    For this program, you will be working with data from the NASA website which lists Near Earth Objects detected by the JPL Sentry System. You are given a text file listing the designation and impact probability (with Earth, generally within the next 100 years) of 585 Near Earth Objects. Your job will be to sort these objects by their impact probabilities. Input File Format The input file contains 585 records. Each record is on a separate line. Each line contains...

  • InformationSystem - It is related to accounting information systems. Extreme Sports Sdn Bhd manufactures sporting goods....

    InformationSystem - It is related to accounting information systems. Extreme Sports Sdn Bhd manufactures sporting goods. You have been asked to evaluate the proposed redesign of Extreme's purchasing system. The new system will use a materials inventory master file, an open purchase order master file, and a supplier history file, all organized in a relational database system. System inputs will include materials inventory receipts and issue transactions, which will be keyed in as they occur from online terminals located in...

  • // includes [1 mark] // structure definition [5 marks] // global variables [2 marks] // function...

    // includes [1 mark] // structure definition [5 marks] // global variables [2 marks] // function prototypes [2 marks] // main function (no menu required – just invoke the function calls to // satisfy the requested program sequence) [5 marks] // Code all necessary functions [25 marks] Q6. [40 MARKS] Write and document a complete C program to satisfy the following requirements. Given a sequential text file that has the following layout where each line is one record containing the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT