CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: please help

  1. #1
    Join Date
    Jul 2008
    Posts
    3

    please help

    i need to create an account class that a bank might use to represent customers bank accounts. i need to include a data member of type int to represent the account balance, provide a constructor that receives an initial balance to make sure that its greater than or equal to 0. if not set the balance to 0 and display an error message indicating that the initial balance was invalid. provide 3 member functions. member function credit should add an amount to the current balance. member function debit should withdraw money from the account and ensure that the debit amount does not exceed the accounts balance. if it does the balance should be left unchanged and the function getbalance should return the current balance . create a program that creates two account abjects and test the member function of class account.


    thats my problem i have no idea here to start.
    ps i have to write the program in bloodshead
    Edit/Delete Message

  2. #2
    Join Date
    Oct 2005
    Location
    Minnesota, U.S.A.
    Posts
    680

    Re: please help

    This sounds like homework.

    As mentioned many times here on the CG forums, we will not write code for you, but I can point you in a direction.

    Create a class that contains the members you mention. Use methods to add the data that do the checks that you mention. Use a collection class (or a pointer array) to store an array of the classes that contain the data for each "customer". This is a basic database.

    -Erik

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