Errors that I am receving
Transactioncounter is undeclared
class SavingsAccount has no member name transactionCounter
class SavingsAccount has no member name getTotalLostToFee
class SavingsAccount has no member name transactionCounter
class CheckingAccount has no member name getTotalLostToFee
unterminated #ifndef
amount undeclared
#include <fstream>
#include "COSC214Lab3.h"
using namespace std;
int main()
{
SavingsAccount savingsAccount;
savingsAccount.getBalance();
savingsAccount.setBalance(amount);
savingsAccount.withdraw(amount);
savingsAccount.deposit(amount);
savingsAccount.getTotalLostToFee();
savingsAccount.getTransactionCounter();
CheckingAccount checkingAccount;
checkingAccount.getBalance();
checkingAccount.setBalance(amount);
checkingAccount.withdraw(amount);
checkingAccount.deposit(amount);
checkingAccount.getTotalLostToFee();
checkingAccount.getTransactionCounter();
ifstream inData("input.txt");
ofstream outData("output.txt");
string transactionType, accountType;
double amount;
while(inData >> accountType >> transactionType >> amount)
{
if(accountType == "savings")
{
if(transactionType == "deposit")
{
savingsAccount.deposit(amount);
}
else if(transactionType == "withdraw")
{
savingsAccount.withdraw(amount);
}
}
else if(accountType == "checking")
{
if(transactionType == "deposit")
{
checkingAccount.deposit(amount);
}
else if(transactionType == "withdraw")
{
checkingAccount.withdraw(amount);
}
}
}
outData << "Savings Total: " << savingsAccount.getBalance() << endl;
outData << "Checking Total: " << checkingAccount.getBalance() << endl;
system ("PAUSE");
return 0;
}
#ifndef COSC214Lab3_H
#define COSC214Lab3_H
class SavingsAccount
{
double balance;
static const double WITHDRAW_FEE = 0.0;
double transactioncounter;
double totalLostToFee;
public:
SavingsAccount();
SavingsAccount(double balance);
void setBalance(double amount);
void withdraw(double amount);
void deposit(double amount);
double getBalance();
getTotalLostToFee();
getTransactionCounter();
};
class CheckingAccount
{
double balance;
static const double WITHDRAW_FEE = 0.5;
double transactioncounter;
double totalLostToFee;
public:
CheckingAccount();
CheckingAccount(double balance);
void setBalance(double amount);
void withdraw(double amount);
void deposit(double amount);
double getBalance();
getTotalLostToFee();
getTransactionCounter();
};
SavingsAccount::SavingsAccount()
{
balance = 100.0;
}
SavingsAccount::SavingsAccount(double balance)
{
balance = balance;
}
void SavingsAccount::setBalance(double amount)
{
balance = amount;
}
void SavingsAccount::withdraw(double amount)
{
balance -= amount + WITHDRAW_FEE;
totalLostToFee += amount*WITHDRAW_FEE;
transactionCounter++;
}
void SavingsAccount::deposit(double amount)
{
balance += amount;
transactionCounter++;
}
double SavingsAccount::getBalance()
{
return balance;
}
CheckingAccount::CheckingAccount()
{
balance = 100.0;
}
CheckingAccount::CheckingAccount(double balance)
{
balance = balance;
}
void CheckingAccount::setBalance(double amount)
{
balance = amount;
}
void CheckingAccount::withdraw(double amount)
{
balance -= amount + WITHDRAW_FEE;
totalLostToFee += amount*WITHDRAW_FEE;
transactionCounter++;
}
void CheckingAccount::deposit(double amount)
{
balance += amount;
transactionCounter++;
}
double CheckingAccount::getBalance()
{
return balance;
}
#endif