Ok this is the finished bank program that I attached to the post. It works and does the things I wanted it to:
1. Withdraw from checking acc
2. Withdraw from Savings acc
3. deposit to checkings acc
4. deposit to savings acc
5. see your balance in checkings
6. see your balance in savings
7. quit
I have a pin number that is installed and it is 7410.
Now, I have to make data files of at least 5 customers using sequential access files. I have to put a name, a pin, a checking balance, and a savings balance of the customer. Where do I start.?
void ProgramDescription(); //
int Get_pinnumber(); //
int Get_pinnumber1(); //
int Get_pinnumber2(); //
int Get_option(); //
int withdrawlC(); //
int withdrawlS(); //
int depositC(); //
int depositS(); //
int calcwithc(); //
int calcwiths(); //
int calcdepc(); //
int calcdeps(); //
//Program Description.
void ProgramDescription()
{
cout << "This program simulates an ATM machine.\n\n";
cout << "Welcome to Banks-O-Million.\n\n";
cout << "Please hit any key to continue.\n\n";
getch();
}
//Gets PIN number.
int Get_pinnumber()
{
system ("cls");
cout << "Please enter your 4 digit PIN number.\n";
cin >> record.pinnumber2;
if (pinnumber == record.pinnumber2)
{
cout << "You may move on to the next screen. Hit any key to get there." << endl;
getch();
}
else
{
cout << "You have entered the wrong PIN number. You have 2 more attempt(s) left. Please hit any key to get to the next screen and try again." << endl;
getch();
Get_pinnumber1();
}
}
//if they get it wrong, it goes here.
int Get_pinnumber1()
{
cout << "Please enter your 4 digit PIN number.\n";
cin >> record.pinnumber2;
if (record.pinnumber2 == pinnumber)
{
cout << "You may move on to the next screen. Hit any key to get to the next screen." << endl;
getch();
}
else
{
cout << "You have entered the wrong PIN number. You have one more attempt(s) left. Please hit any key to get to the next screen, and try again." << endl;
getch();
Get_pinnumber2();
}
}
//If they get it wrong again, it goes here.
int Get_pinnumber2()
{
cout << "Please enter your 4 digit PIN number.\n";
cin >> record.pinnumber2;
if (record.pinnumber2 == pinnumber)
{
cout << "You have entered the correct PIN number. Please hit any key to get to the next screen." << endl;
}
else
{
cout << "You have entered the wrong PIN number 3 times incorrectly. This ATM is now eating up your card.\a\a\a\a\a\a\a." << endl;
return 0;
}
}
//Gets their option for what they want to do.
int Get_option()
{
system ("cls");
cout << "What would you like to do today: \n";
cout << "Enter an option:\n\n";
cout << "1-Withdraw from your Checking account\n\n";
cout << "2-Withdraw from Savings account.\n\n";
cout << "3-Deposit to Checking account.\n\n";
cout << "4-Deposit to Savings account.\n\n";
cout << "5-See your balance in your checking account.\n\n";
cout << "6-See your balance in your savings account.\n\n";
cout << "7-Quit.\n\n";
cout << "Option: ";
cin >> record.option;
system ("cls");
//prints out atm option chosen.
switch (record.option)
{
//withdrawal from checking option.
case 1:
withdrawlC();
break;
//withdrawl from savings option.
case 2:
withdrawlC();
break;
//Deposit to checking account
case 3:
depositC();
break;
//Deposit to savings account.
case 4:
depositS();
break;
//See checking balance.
case 5:
cout << "You currently have $" << checkbalance << " in your checking account.\n";
cout << "Hit any key to end the program";
return 0;
break;
//See savings balance.
case 6:
cout << "You currently have $" << savebalance << " in your savings account.\n";
cout << "Hit any key to end the program";
return 0;
break;
//Quit.
case 7:
cout << "Thank you for using this ATM. Please hit any key to exit.";
return 0;