Write a separate main() function that has 2 int selections to execute the program. The main() must create objects and assign account holder’s name, account number and initial balance before proceeding. If account number == 0 none of the below operation can be performed. The 2 selections are:
1 : Deposit
2 : Withdrawal
Use switch case to determine the choice and filter invalid valuesestion here.
ATM BankAccount(number, AccountName, balance);
if (number != 0)
{
int num;
cout << "Enter amount selection: [1] Deposit or [2] WithDrawal: ";
cin >> num;
switch (num)
{
case 1:
cout << "Your balance is: " << BankAccount.Deposit();
break;
case 2:
cout << "Your balance is: " << BankAccount.WithDrawal();
break;
}
cout << endl << endl;
}
}
p/s : i already create bank.h with atm.h header file. So this is the code. I can't get the switch selection correct. Im not sure about the switch selection part.
Dear mutexe, why when executing my program after press [1] the console does not calculate and it ends by showing ''please enter to continue''. Please help.
double Deposit()
{
getAmount();
return AccountM->Deposit(balance, amount); // -> is a 'THIS' pointer
}
void getAmount()
{
cout << "Key in amount: " << amount << endl;
}
is a bit screwed. getamount just prints zero to the screen, but then your code does output the balance I entered just fine.
Enter your name: tom
Enter your amount: 500
Enter your initial balance: 200
Enter your amount selection: [1] Desposit or [2] WithDrawl: 1
Key in amount: 0
Your balance is: 200