Hey all I am new here so sorry if this is a spaghetti post but this is the only place that I could turn with an assignment due in such a short amount of time.
Basically I need to develop a class that models the basic workings of a bank account. Including writing the header/interface file and the definition/implementation file, completing the following tasks
save the account balance, save the number of transactions performed, allow deposits and withdrawals, calulate the interest for the period, and report the current account balance and number of transactions at any time.
The diagram given is-
Account
-balance:double
-interestRate:double
-interest:double
-transactions:integer
void displayMenu();
void makeDeposit(Account &);//The tester/user can write own functions
void withdraw(Account &); //using the newly created type -Account that is-
int main()
{
Account savings; //instantiating an object from Account class
char choice; //menu selection
do
{
//Display the menu and get a valid selection
displayMenu();
cin >> choice;
//check to make sure that the choice is valid
while (toupper(choice) < 'A' || toupper(choice) > 'G')
{
cout << "Please make a choice in the range "
<< "of A through G: ";
cin >> choice;
}//end while
//Process the user selection
switch(choice)
{
case 'a':
case 'A': cout << "The current balance is $";
cout << savings.getBalance() << endl;
break;
case 'b':
case 'B': cout << "There have been ";
cout << savings.getTransactions() << "transactions.\n";
break;
case 'c':
case 'C':cout <<"Interest earned for this period: $";
cout << savings.getInterest() << endl;
break;
case 'd':
case 'D': makeDeposit(savings);
break;
case 'e':
case 'E': withdraw(savings);
break;
case 'f':
case 'F': savings.calcInterest();
cout << "Interest added.\n";
break; //optional but good to put it here
}//end switch
}while (toupper(choice) != 'G');//end do while
return 0;
}
void displayMenu()
{
cout <<"\n Menu\n";
cout <<"++++++++++++++++++++++++++++++\n";
cout << "A)Display the account balance\n";
cout << "B)Display the number of transactions\n";
cout << "C)Display interest earned for this period\n";
cout << "D)Make a deposit\n";
cout << "E)Make withdrawl\n";
cout << "F)Add interest for this period\n";
cout << "G)Exit the program\n\n";
cout << "Enter your choice: ";
}//end displayMenu
//===========================================================
//Definition of function makeDeposit. This function accepts =
//a reference to an Account object. The user is prompted for=
//the dollar amount of the deposit, and the makeDeposit =
//member of the account object is then called. =
//===========================================================
void makeDeposit(Account &acnt)
{
double amt;
cout << "Enter the amount of the deposit: ";
cin >> amt;
cin.ignore();
acnt.makeDeposit(amt);
}//End makeDeposit
//############################################################
//Definition of function withdraw. This function accepts #
//a reference to an Account object. The user is prompted for #
//the dollar amount of the withdrawal, and the withdraw #
//member of the Account object is then called. #
//############################################################
void withdraw(Account &acnt)
{
double amt;
cout <<"Enter the amount of withdrawal: ";
cin >> amt;
cin.ignore();
if (!acnt.withdraw(amt))
cout << "Client Message: Withdrawal amount is too large.\n\n";
}//end withdraw function
If anyone could please help me I would be very happy. Thanks everyone