CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2010
    Posts
    3

    Unhappy Bank project- link accounts to different customers?

    Hi,
    I'm trying to link bank accounts to customers that are in a customerlist.
    At the moment i have a customerlist which contains the name of the customer and their id.

    it is a console application and I have to do it by switch statement cases - and so the case "openaccount" should therefore open an account for the given customer id.

    I have a base class and all the different accounts e.g. savings, taxfree etc all inherit from this class.

    an example of how my "addcustomer" is shown below:

    case "addcustomer":

    String name = arguments[1];
    bool error2 = false;

    foreach (Customers x in customerList)
    {
    if (name.Equals(x.getName()))
    {
    Console.WriteLine("Error:" + ErrorCodes.CustomerAlreadyExists);

    error2 = true;
    }
    }

    string l= "1";
    Convert.ToInt32(l);

    if (error2 == false)
    {
    Customers customer = new Customers(name);
    customerList.Add(customer);
    Console.WriteLine(customer.GetID());
    }
    break;

    any help would REALLY be appreciated as i have been stuck on this for the past week now.

    thanks

  2. #2
    Join Date
    Jun 2008
    Posts
    2,477

    Re: Bank project- link accounts to different customers?

    Code:
    Dictionary<Customer, Account> _accounts;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured