I am learning C++ and having difficulty getting my code to compile. I get errors while compiling using VS2010, everytime I attempt to fix the errors it seems to cause a snowball effect of compilation failures. Can someone look over the code and maybe give me some hints on how to fix it?
#ifndef MENU_BUILDER_H
#define MENU_BUILDER_H
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
using namespace std;
//Define my class
class MenuBuilder
{
double amount;
private:
string accountNumber;
string firstName;
string middleName;
string lastName;
double withdrwal;
double deposit;
double balance;
public:
MenuBuilder();
MenuBuilder(string accountNumber, string firstName, string middleName, string lastName,
double withdrwal, double deposit);
void checkBalance();
void withdrawal();
void deposit();
void viewAccount();
void viewStatement();
void viewBankInformation();
~MenuBuilder(void);
};
MenuBuilder::MenuBuilder(void)
{
amount=2439.45;
}
MenuBuilder::~MenuBuilder(void)
{
}
void MenuBuilder::checkBalance()
{
cout<<endl<<"Current balance is: $"<<amount;
}
void MenuBuilder::withdrawal()
{
double amt;
cout<<endl<<"How much would you like to withdraw? $ ";
cin>>amt;
amount=amount-amt;
}
void MenuBuilder::deposit()
{
double amt;
cout<<endl<<"How much would you like to deposit? $ ";
cin>>amt;
amount=amount+amt;
}
void MenuBuilder::viewAccount()
{
cout<<endl<<"Name: (Phil Sutton)";
cout<<endl<<"Account Number: XXXXXXXXXX ";
}
void MenuBuilder::viewStatement()
{
cout<<endl<<"01/01/11 - McDonalds - $6.27";
cout<<endl<<"01/15/11 - Kwik Trip - $34.93";
cout<<endl<<"02/28/11 - Target - $124.21";
}
void MenuBuilder::viewBankInformation()
{
cout<<endl<<"Devry Bank, established 2011";
cout<<endl<<"(XXX) XXX-XXXX";
cout<<endl<<"12345 1st St.";
cout<<endl<<"Someplace, NJ 12345";
}
int main()
{
char choice;
MenuBuilder atm;
cout<<endl<<"Welcome to the Devry Bank Automated Teller Machine";
do
{
cout<<endl<<endl<<"1. Check balance";
cout<<endl<<"2. Make withdrawal";
cout<<endl<<"3. Make deposit";
cout<<endl<<"4. View account information";
cout<<endl<<"5. View statement";
cout<<endl<<"6. View bank information";
cout<<endl<<"7. Exit";
cout<<endl<<"Enter your choice: ";
cin>>choice;
switch (choice)
{
case '1':
atm.checkBalance();
break;
case '2':
atm.withdrawal();
break;
case '3':
atm.deposit();
break;
case '4':
atm.viewAccount();
break;
case '5':
atm.viewStatement();
break;
case '6':
atm.viewBankInformation();
break;
case '7':
cout<<endl<<"Exit the program"<<endl;
system("pause");
return 0;
default:
cout<<endl<<"Invalid choice.";
}
}while(true);
system("pause");
return 0;
#endif;
}