ATM program.

I am lost on this program. I dont even know were to start. Could someone atleast walk me through it?


Write a C++ program that will allow a consumer to withdraw funds from their bank accounts (Checking, Saving), check the balance of their bank accounts, choose which account to withdraw from. Choose the amount to withdraw. Show the remaining balance etc. We will assume that the consumer has a checking balance of $3,230.00, and a savings balance of $6,000.00.

I would like the pseudocode and flowchart for this project if you modified the one you previously turned in. I want the program to be at least four to five levels deep in terms of menus. (hint switches or if else chains would work great in this program) For example, think about how you use the ATM machine and all the choices you have to make until you get to the right menu.
What paradigm will you be using? I.e. Have you learned about/are expected to use classes?
Im not sure what you mean..
Okay then your whole program will be in the main function I assume?
Yes.
So the first question is how do you want to store the money, as an int or double (either can work.) Then create two variables one for the checking account and the other for the savings.
Sorry.
Last edited on
@GamexCoder: Please don't post full solutions to problems without any comments. Learning by example only works if (1) the OP whats to learn and doesn't just steal your solution, (2) if the OP can understand what you posted, and (3) what you post is correct and uses good academic habits.
Last edited on
Ok. SO i will use int function and how would i put them into variables as a program?
closed account (z0RDjE8b)
@zbowers16

The program you are assigned to do/intend to do is very simplistic in logic.

Assuming that you're doing this from a simple console window, create a few data types to handle the balance, savings, etc.

From there on, some if else can handle the choices given for the user to make, etc.

I just finished one of my first programs ever like that and I can provide the code for you if you want, or show you a pseudo-code example.

Ok. SO i will use int function and how would i put them into variables as a program?


You don't know how to put variables in to a program?
Last edited on
@ BooleanBoy

Is there any way you can send the code but with notes on how to do what. I need to learn how to do this so anything would help. Thanks.
closed account (z0RDjE8b)
Ok. Let's get down to basics.

First, you'll need two declare two shorts or two doubles for the containers that will hold
the checking and saving's accounts total money
depending on if you prefer to use floating-point numbers,
truncation, the whole math rounding off bit, etc.

Call one Checking and the other Savings.

Now declare two separate functions above the main function.
Make it a void, call it whatever you want, but leave it blank
(hence, it's a prototype). The blank functions above should look something like this:

1
2
void CheckingsTotal();
void SavingsTotal();


We are using these two small function prototypes so that we can
change the control block of the execution of the program so
that later when we call the function we will execute it and have it
display the amount of money is available depending on whether the
user selects Savings or Checkings.

Now as for the logic if else part, assuming you've never really used if statements
or are inexperienced somewhat, the if statement is
just a logical way of determining if something is TRUE or FALSE
or EQUAL, LESSER or GREATER. Whether it's true or false we will follow the appropriate commands based on what the user's
selection was against the statement. In this case, we will
have two logical things to take against the statement: checking or savings, correct?

We create a string and declare it just like every other container:

string choice;

This will hold the logical choice that you will make based whether you want checking or savings.

Use the basic input/output console window code:

cin >>

and

cout <<

Have the user perform a cin >> choice; right before the if statement begins so that we can test the choice against the statement's comparison, like this:

1
2
3
4
5
6
7
cin >> choice;
if(choice == "checking") // <-- Meaning if you entered "checking" and hit enter.
{
CheckingsTotal(); // If "choice" was input "checking", the statement WAS in fact TRUE and you'll be taken to the "CheckingsTotal" function which
//will contain the appropriate code to print the Checking's value 
//based on the amount you gave the Checking's data type.
}


After this, just basically copy it but with the value of SAVINGS instead of checking.

Are you with me so far?
Last edited on
so....
cin >> choice;
if(choice == "checking")
{
checkingstotal ();

cin >> choice;
if(choice == "savings")
SavingsTotal ();


Confused
You only need them to input one choice because the program should check all options when the person puts the choice in. If you don't really know how to put values in variables, then I think you should avoid functions completely.

cin >> choice;

Check to see what account they want.
Use an int or double to get the amount they want to withdraw.
Check to make sure they are not over drafting their fund.
Remove money from account user chose.
Ask user if they are finished making transactions.
Start over again if they want to continue.

It's only three levels deep, but if you can figure this much out, then I'm sure you can figure out how to add two levels.
ok this is what i have so far and it works perfect but competely forgot to make them choose wheather they want checkings or savings can someone tell me how to just put it in this code without altering everything?

#include <iostream>
using namespace std;

int main()

{

int password;

for (int i=0;i<3;i++)

{cout <<"enter password:\n";
cin>>password;

if (password==123456)
{cout<<"korek!!!\n";

double balance = 3230;
double withdraw, deposit;
int option;
cout<<"\n";
cout<<" ***MOGOL***\n";
cout<<"*** Automated Teller Machine***"<<endl;
cout<<"Choose a Transaction:\n";
cout<<"\n";
cout<<"[1] Inquire Balance \n"
<<"[2] Withdraw \n"
<<"[3] Deposit \n"
<<"[4] Quit \n"
<<"\n"
<<"Enter Option:";
cin>>option;

switch(option)
{
case 1:
cout<<"\n[[[BALANCE INQUIRY]]]\n";
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout<<"\n Your current balance is $"<<balance<<endl;
break;
case 2:
cout<<"\n[[[WITHDRAW]]]\n";
cout<<"Enter amount: $";
cin>>withdraw;

balance = balance - withdraw;

cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);

cout<<"You withdrew $"<<withdraw<<endl;
cout<<"Your remaining balance is $"<<balance<<endl;
continue;
case 3:
cout<<"\n[[[DEPOSIT]]]\n";
cout<<"Enter amount: $";
cin>>deposit;

balance = balance + deposit;

cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);

cout<<"You deposited $"<<deposit<<endl;
cout<<"Your new balance is $"<<balance<<endl;
continue;
case 4:
cout<<"\n***[[[EXIT MODE]]]***\n";

break;


default:
cout<<"\n That is an invalid option \n";
}

break;
}
else


cout<<"Pls try again!!!\n";
}

return 0;
}

Topic archived. No new replies allowed.