need help, what I need to do is have the status function run before each withdrawl to let the user know if the account is active or inactive. Active = balance > 25, if account balance <25 then no withdrawls can occur. I have the following:
#include <iostream>
#include "Savings.h"
using namespace std;
bool Savings::withdraw(double amount)
{
if (balance < amount)
return false; //not enough in the account
else
{
balance -= amount;
transactions++;
return true;
}
}
void Savings::status(bool active)
{
if (balance > 25)
{
bool active = true;
cout << "Account is active\n";
}
else
{
bool active = false;
cout << "Account is inactive\n";
}
}
in generic.cpp I have:
int main()
{
Generic check; //object of Generic class created
Savings save; //object of Savings class created
CharRange input ('A', 'I'); //object of CharRange class created, will check for chars A-G
char choice;
save.status(true);
void withdraw(Savings &savings)
{
bool save;
double dollars;
cout << "Enter the amount of the withdrawl: ";
cin >> dollars;
cin.ignore();
if(!savings.withdraw(dollars))
cout << "ERROR: Non-sufficient funds.\n\n"; save.status();
}