Ok i have been working on this for a few days and can not get my main right. I have tried so many diffrent things and couldnt get it any help is appreciated.

Design, write, and test a program that simulates some aspects of a simple savings account in a bank. As you read the problem description, sketch a UML diagram of the ACCT class in the handy UML form below. The box will fit the text you type. Refer to page 654 of the Malik book to remind yourself of the UML format.

Your dotNet project should contain three files:
Acct.h – The Acct class header file
Acct.cpp – The Acct class implementation file
AcctTest.cpp – A file containing a main( ) to test your Acct class.

First you need to describe an account class which contains the following:

1.the private data member includes:
a.the balance in dollars and cents (double data type).
2.the public member functions include:
a.the default constructor – should initialize the balance to 0,
b.an explicit value constructor – which sets the balance to whatever value is passed in,
c.a function called getbalance that returns the balance of the account,
d.a function called deposit that deposits money into the account, and
e.a function called withdraw that withdraws from the account if the withdrawal amount does NOT exceed the account balance.

The getbalance member function has no arguments. This function should return the current balance in the account.

The single argument of the deposit function is the deposit amount. The deposit function should add the deposit amount to the current balance. The deposit function should return the new balance.

The single argument of the withdraw member function is the withdrawal amount. The withdraw function should attempt to withdraw the withdrawal amount from the current balance. If the withdrawal amount is less than or equal to the current balance, then reduce the current balance by the withdrawal amount. If the withdrawal amount is greater than the current balance, do not change the balance. The withdraw function should return a boolean indicating whether the withdrawal was successful or not. Return true if successful.

The main program should thoroughly test the account class. Make sure to test both the default and the explicit value constructors. For each transaction, output what transaction you are about to perform on which account. After each transaction, be sure to display the balance in the account.
When you have your test program and account class working, get a sign off from the instructor. Turn in your UML diagram, a screen shot of your program’s output, and the source code for all three files you wrote.

Sorry for the long problem i just didnt want to leave anything out here is what i ahve so far.

Header file

class accountFunction
	void withdraw(double userWithdraw);

	void deposit(double userDeposit);

	double getBalance() const;
	//default constructor

	double bal;

Implementation file


using namespace std;

void accountFunction::deposit(double userDeposit)
	bal = bal + userDeposit;

void accountFunction::withdraw(double userWithdraw)
	if (userWithdraw < bal)
		cout << " Account balance too low ";
	else (userWithdraw > bal);
		bal = bal - userWithdraw;

double accountFunction::getBalance() const

return bal;


Test file


using namespace std;

int main

1) your implementation file is missing the class constructor implementation.

2) your class is missing a default constructor as required by the assignment # 2a.

3) Post the attempts you have made to write main() and test the various functions. I would suggest you write a menu something like this:

1.  Create a new account
2.  Deposit
3.  Withdraw
4.  Show Balance
5.  Quit
This article has been dead for over six months. Start a new discussion instead.