Getting function call error
May 19, 2014 at 12:33am UTC
My compiler is giving me errors not sure what I did wrong?
Error 1 error C3867: 'Account::get_balance': function call missing argument list; use '&Account::get_balance' to create a pointer to member c:\users\sean\documents\school\new25\new25\new25\new25.cpp 145 1 New25
Error 2 error C3867: 'Account::get_balance': function call missing argument list; use '&Account::get_balance' to create a pointer to member c:\users\sean\documents\school\new25\new25\new25\new25.cpp 146 1 New25
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
#include <iostream>
#include <iomanip>
using namespace std;
class Account
{
public :
Account();
Account(double dep);
Account(double dep, double in);
void make_deposit(double dep);
void make_withdrawal(double in);
double get_balance();
virtual double daily_interest() = 0;
private :
double balance;
double deposit;
double withdraw;
};
Account::Account()
{
balance = 0.0;
}
Account::Account(double dep)
{
balance = dep;
}
Account::Account(double dep, double in)
{
balance = dep - in;
}
void Account::make_deposit(double dep)
{
balance = balance + dep;
}
void Account::make_withdrawal(double in)
{
balance = balance -in;
}
double Account::get_balance()
{
return balance;
}
class Checking :public Account
{
public :
Checking();
Checking(double dep);
Checking(double dep, double in);
virtual double daily_interest();
private :
double interest_rate = 0.03 / 30;
double min_balance = 1000;
};
Checking::Checking() :Account(){}
Checking::Checking(double dep) : Account(dep){}
Checking::Checking(double dep, double in) : Account(dep,in){}
double Checking::daily_interest()
{
bool more = true ;
double amt = 0.0;
int day = 0;
if (Account::get_balance() - min_balance <= 0)
{
more = false ;
amt = 0.0;
}
else
{
amt = (Account::get_balance() - min_balance)*interest_rate;
Account::make_deposit(amt);
}
return amt;
}
class Savings :public Account
{
public :
Savings();
Savings(double dep);
Savings(double dep, double in);
virtual double daily_interest();
private :
double interest_rate = 0.06 / 30;
double min_balance = 0.0;
};
Savings::Savings() :Account(){}
Savings::Savings(double dep) : Account(dep){}
Savings::Savings(double dep, double in) : Account(dep, in){}
double Savings::daily_interest()
{
double amt = 0.0;
amt = Account::get_balance()*interest_rate;
Account::make_deposit(amt);
return amt;
}
int main(){
int n = 0;
double deposit = 0.0;
double withdrawal = 0.0;
bool more = true ;
int i = 1;
char type = ' ' ;
Account * account;
Checking c;
Savings s;
for (i = 0; i < 30; i++)
c.make_deposit(i * 5);
c.make_withdrawal(i * 2);
c.daily_interest();
s.make_deposit(i * 5);
s.make_withdrawal(i * 2);
s.daily_interest();
if (i % 10 == 0)
{
cout << "daily" << i << "\n" ;
cout << "Checking Account Balance:" << c.get_balance << "\n" ;
cout << "Savings Account Balance:" << s.get_balance << endl;
}
system("pause" );
return 0;
}
May 19, 2014 at 12:35am UTC
line 146, 147 both missing () on function call
May 19, 2014 at 12:47am UTC
Thank you wildblue....
Topic archived. No new replies allowed.