I finished writing my program, but as I debug it, my chosen choice goes to the default statement in my switch statement. I don't know why...
[code]
Put the code you need help with here.
[/#pragma once
#ifndef MENUBUILDER_H
#define MENUBUILDER_H
// preprocessor commands
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
class MenuBuilder
{
private:
double currBalance; //holds the balance
case '2':
cout << "How much would you like to withdraw from your account?" << endl;
cin >> withdrawal;
if (currBalance > withdrawal && withdrawal > 0)
{
newBal = currBalance - withdrawal;
cout << "Your new account balance is $ " << newBal << endl;
}
else
cout << "You made an invalid withdrawal";
cout << "Please make a selection from the above menu." << endl;
break;
case '3':
cout << "How much would you like to deposit to your account?" << endl;
cin >> deposit;
if (deposit > 0)
{
newBal = currBalance + deposit;
cout << "Your new account balance is $ " << newBal << endl;
cout << endl;
}
else
cout << "You made an invalid deposit";
cout << "Please make a selection from the above menu." << endl;
break;
case '4':
cout << "Name: Norman Brandon" << endl;
cout << "Account Number:1234554321 " << endl;
cout << endl;
cout << "Please make a selection from the above menu." << endl;
break;
case '5':
cout << " 01/01/11 - McDonald's - $6.27" << endl;
cout << "01/15/11 - Kwik Trip - $34.93" << endl;
cout << "2/28/11 - Target - $124.21" << endl;
cout << endl;
cout << "Please make a selection from the above menu." << endl;
break;
case '6':
cout << "Devry Bank, established 2011" << endl;
cout << "(123) 456-7890" << endl;
cout << "12345 1st. St." << endl;
cout << "Someplace, NJ. 12345" << endl;
cout << "Please make a selection from the above menu." << endl;
break;
case '7':
cout << "Thank you for chosing the Automated Teller Program." << endl;
cout << "Good-bye" << endl;
break;
default:
cout << "Invalid selection." << endl;
cout << endl;
cout << "Please make a selection from the above menu." << endl;
break;
}
}
#include "Menubuilder.h"
int main()
{
int choice = 0;
MenuBuilder transactions;
while (choice != 7)
{
transactions.buildMenu();
cin >> choice;
transactions.processInput(choice);
}
return 0;
}