Thread: Bank Account Problem

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    3

    Unhappy Bank Account Class Problem

    Problem Overview
    The First National Bank of Parkland has asked you to design and develop an account transaction database system. The system allows bank employees to:

    1) Setup an account for a new customer (make sure your system can hold at least 20 total customers). Every customer account should contain the customer first and last name, address, social security number (SS#), interest rate, and a field for the total balance in the account.

    2) Print account information for a single customer or the entire list of customer accounts. Include in the output all information for each account (name, address, SS#, interest rate, type of account, balance) in a readable and well organized output format.


    Develop a menu-driven interactive system that provides bank employees with a menu listing the various commands available and continue until the user terminates the program. An example of a typical session might look like:

    ----------------------------------------
    Welcome to the First National Bank
    of Parkland - Account transaction system
    ----------------------------------------

    Enter any of the following commands:
    1) Create account
    2) Print accounts
    3) Select account
    4) Deposit
    5) Withdrawal
    6) Quit
    We're supposed to use object oriented classes so I created an Account class for the customer information:

    customer.h
    Code:
    #include <iostream>
    #include <string>
    using namespace std;
    
    class account
    {
       private:
          string first;
          string last;
          string address;
          string SS;
    
       public:
          void init();
          void print();
    };
    customer.cpp
    Code:
    #include "customer.h"
    
    void customer::init()
    {
       cout << "\nNew Account" << endl;
       cout << "Enter the first name of the depositor: ";
       getline(cin, first, '\n');
       cout << "Enter the last name of the depositor: ";
       getline(cin, last, '\n');
       cout << "Enter the address: ";
       getline(cin, address, '\n');
       cout << "Enter social security #: ";
       getline(cin, SS, '\n');
    }
    
    void customer::print()
    {
       cout << "Name of depositor: " << first << " " << last << endl;
       cout << "Address: " << address << endl;
       cout << "Social Security #: " << SS << endl;
    }
    But then I got to thinking about how I was going to implement the interactive menu. I can't figure out how it's going to keep track of and display new and existing customers so that the user can pick a customer from the menu and edit it or print it etc.

    Any help would be greatly appreciated.
    Last edited by JayBlay77; 03-18-2009 at 09:23 PM.

  2. #2
    Registered User
    Join Date
    Feb 2009
    Posts
    42
    Start by creating functions for each command it needs to have.

    You could make for example a vector holding all the accounts, so you could add accounts to system, and display them.

    To create an account, you would simply add one account to that vector.

    To print all accounts, you would print all members of the vector.

    To select an account, you could display all accounts and assign a number for each account.

    For example:
    1 - AccA
    2 - AccB
    3 - AccC

    To choose AccA you would input 1, so it would be index 0 of the vector holding all the accounts. Then you could add deposit and withdrawal to that account or whatever you want to do.

    There's many ways to do this, so I suggest you start by implementing functions for each operation you need, and implement the menu later.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data read off disk problem
    By Sly in forum C Programming
    Replies: 9
    Last Post: 01-13-2009, 04:33 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Problem with the linked list
    By a_learner in forum C Programming
    Replies: 2
    Last Post: 12-03-2001, 06:08 PM
  4. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 06:05 PM