Click to See Complete Forum and Search --> : please help


jmb8806
July 31st, 2008, 10:14 AM
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

egawtry
July 31st, 2008, 10:43 AM
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