Ok I fixed it sorry!
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
|
#ifndef ACCOUNT_H
#define ACCOUNT_H
#include "Customer.h"
//Account Class
class Account {
private:
Customer myCustomer[2];
string type;
int number;
double balance;
double rate;
double intrest;
double NewBalance;
public:
Account(); // Constructor
Account(string, int, double, double);
void setType(string);
void setNumber(int);
void setBalance(double);
void setRate(double);
string getType();
int getNumber();
double getBalance();
double getRate();
void valid_Rate(double);
void ApplyInterest();
};
#endif
//-----------------------------------------------------------------------------
//class definition
Account::Account() {
type = " ";
number = 0;
balance = 0;
rate = 0;
}
Account::Account(string type, int number, double balance, double rate) {
Account::type = type;
Account::number = number;
Account::balance = balance;
valid_rate(rate);
}
void Account::setType(string type) {
Account::type = type;
}
void Account::setNumber(int number) {
Account::number = number;
}
void Account::setBalance(double balance) {
Account::balance = balance;
}
void Account::setRate(double rate) {
valid_rate(rate);
}
string Account::getType() {
return type;
}
int Account::getNumber() {
return number;
}
double Account::getBalance() {
return balance;
}
double Account::getRate() {
return rate;
}
void Account::valid_rate(double rate) {
if (rate >=.01 && rate <= .1)
Account::rate=rate;
else {
Account::rate=0;
cout << "WARNING! You have entered an invalid rate!\n";
}
}
void Account::ApplyIntrest() {
intrest = rate * balance;
NewBalance = intrest + balance;
cout << "The amount of intrest for the Customer is: $" << intrest << " and the account balance is: $" << NewBalance << ".\n";
}
Customer& getCustomer(int n) {
return myCustomer[n];
}
void operator += (Account& a) {
setBalance(balance + a.balance());
}
void operator -= (Account& a) {
setBalance(balance - a.balance());
}
void operator ++ (int n) {
Customer::balance(Customer::savings + Customer::checking);
}
}
|
1>------ Build started: Project: Test1, Configuration: Debug Win32 ------
1> Test1.cpp
1>\account.h(47): error C3861: 'valid_rate': identifier not found
1>\account.h(62): error C3861: 'valid_rate': identifier not found
1>\account.h(78): error C2039: 'valid_rate' : is not a member of 'Account'
1> \account.h(7) : see declaration of 'Account'
1>\account.h(80): error C2597: illegal reference to non-static member 'Account::rate'
1>\account.h(82): error C2597: illegal reference to non-static member 'Account::rate'
1>\account.h(87): error C2039: 'ApplyIntrest' : is not a member of 'Account'
1> \account.h(7) : see declaration of 'Account'
1>\account.h(88): error C2065: 'intrest' : undeclared identifier
1>\account.h(88): error C2065: 'rate' : undeclared identifier
1>\account.h(88): error C2065: 'balance' : undeclared identifier
1>\account.h(89): error C2065: 'NewBalance' : undeclared identifier
1>\account.h(89): error C2065: 'intrest' : undeclared identifier
1>\account.h(89): error C2065: 'balance' : undeclared identifier
1>\account.h(90): error C2065: 'intrest' : undeclared identifier
1>\account.h(90): error C2065: 'NewBalance' : undeclared identifier
1>\account.h(94): error C2065: 'myCustomer' : undeclared identifier
1>\account.h(97): error C2805: binary 'operator +=' has too few parameters
1>\account.h(98): error C2065: 'balance' : undeclared identifier
1>\account.h(98): error C2248: 'Account::balance' : cannot access private member declared in class 'Account'
1> \account.h(12) : see declaration of 'Account::balance'
1> \account.h(7) : see declaration of 'Account'
1>\account.h(98): error C2064: term does not evaluate to a function taking 0 arguments
1>\account.h(98): error C3861: 'setBalance': identifier not found
1>\account.h(101): error C2805: binary 'operator -=' has too few parameters
1>\account.h(102): error C2065: 'balance' : undeclared identifier
1>\account.h(102): error C2248: 'Account::balance' : cannot access private member declared in class 'Account'
1> \account.h(12) : see declaration of 'Account::balance'
1> \account.h(7) : see declaration of 'Account'
1>\account.h(102): error C2064: term does not evaluate to a function taking 0 arguments
1>\account.h(102): error C3861: 'setBalance': identifier not found
1>\account.h(105): error C2803: 'operator ++' must have at least one formal parameter of class type
1>\account.h(106): error C2597: illegal reference to non-static member 'Customer::balance'
1>\account.h(106): error C2597: illegal reference to non-static member 'Customer::savings'
1>\account.h(106): error C3867: 'Customer::savings': function call missing argument list; use '&Customer::savings' to create a pointer to member
1>\account.h(106): error C2597: illegal reference to non-static member 'Customer::checking'
1>\account.h(106): error C3867: 'Customer::checking': function call missing argument list; use '&Customer::checking' to create a pointer to member
1>\account.h(106): error C2568: '+' : unable to resolve function overload
1> unable to recover from previous error(s); stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========