ATM Problem HELP PLEASE ASAP, I have deadline tomorrow morning.

So i'm still in the process in making this program working by tomorrow morning.
Basically this is how to show the functionality of an ATM Machine and so far this is what the code turned out to be.

/*
* Programmer: BretaƱa, Fidel Jhon A.
* Date Created: 7/17/2012
* Terminal No: 13
* Program: MSIT
* Course / Section: CS127L/BC1
* Purpose: This program will should be able to simulate ATM functionalities.
*/
# include <iostream.h>
#include<stdlib.h>

void selectMenu ();
//this function will display the main menu options
//and will return a value of the selected transaction
// the program should validate the input : selection of options should be 1,2,3 and 4 only
//use do -while loop for validation of option

double depositMoney(double mon);
//this function will simulate deposit transaction
//this function will update the balance once a successful
//deposit transaction occured.
//this function should not allow deposit if amount to deposit is from 100.00 to 400.00
//for the program not to terminate in this case, perform a do while loop to validate the deposit amount and as the user to re enter amount of 500 and/or above .

void widrawMoney(double & WMoney);
//this function will simulate withdraw transaction
//balance should be updated once a success withdraw transaction occurred.
//this function should not allow withdrawal if amount to withdraw is less than 500.00
//maximum withdrawal amount is 5000.00
//withdrawal amount should be displayed with the following breakdown: 100,200,500, and 1000
//for example amount is Php1800.00 breakdowns are:
// 1000 ' 1 =1000.00
// 500 ' 1 = 500.00
// 200 ' 1= 200.00
// 100 ' 1= 100.00
// Total : Php 1800.00

double balanceInquiry (double);
//this function should display the remaining balance

void quitProgram();
//this function will terminate the program using the exit pre-defined object

char tryAgain();
//this function will ask the user if he wants to do another transaction
//this function should return a char type basedon selection made by the user
// Y for yes and N for no will be the ONLY accepted value(s)
//use toupper function for the input
//re-enter the value if the user inputs other character than Y and/or N : use another do-while loop for the validation.

void main()
{
double balance=10000.00;
char ch;
int select, amount;

do
{
void selectMenu ();
do{
cout<<"[1] Withdraw"<<endl
<<"[2] Deposit"<<endl
<<"[3] Balance"<<endl
<<"[4] End Transaction"<<endl;
cin>>select;
switch (select)
{
case 1: //add code here for depositMoney

break;
case 2: //add code here for widrawMoney
cout<<"Enter amount: "<<endl;
cin>>amount;
if(amount>=500)
amount+balance;
cout<<"You have deposited "<<amount<<endl
<<"Your current balance is now: "<<balance<<endl;
break;
case 3://add code here for balanceInquiry;
break;
case 4:// user has selected quit
break;
}//you can add code here
ch=tryAgain();

}while (ch=='Y' || ch == 'y');
system("cls");
}
And what is your question?
I wanna check if what I'm doing is good, and I wanna know where that unexpected error file is located.
You have declared functions and then not defined them. The compiler has no code to link the function with. For example:

1
2
3
4
5
6
7
8
9
int printFive(); // function declaration

... 

int printFive() // function definition -- you are missing these
{
  for(int i = 0; i < 5; i++)
    cout << i << endl;  
}


If this is a C program then void main() is fine, but C++ requires int main()

putting 'void selectMenu();' inside the do loop is wrong. You already declared the function above you just need to define what that function does (outside of main())

When you can get those taken care of then we can help you with the finer details.
closed account (o3hC5Di1)
Texan40 wrote:
putting 'void selectMenu();' inside the do loop is wrong. You already declared the function above you just need to define what that function does (outside of main())


For example (but it will need tweaking):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
int main()
{
   selectMenu();
}


void selectMenu ()
{

char ch;
int select,;

do{
cout<<"[1] Withdraw"<<endl
<<"[2] Deposit"<<endl
<<"[3] Balance"<<endl
<<"[4] End Transaction"<<endl;
cin>>select;
switch (select)
{
case 1: //add code here for depositMoney

break;
case 2: //add code here for widrawMoney
cout<<"Enter amount: "<<endl;
cin>>amount;
if(amount>=500)
amount+balance;
cout<<"You have deposited "<<amount<<endl
<<"Your current balance is now: "<<balance<<endl;
break;
case 3://add code here for balanceInquiry;
break;
case 4:// user has selected quit
break;
}
ch=tryAgain();
}while (ch=='Y' || ch == 'y');
}


To get you on your way with some other functions, but again, we won't just hand you the code:

double depositMoney(double mon);
//this function will simulate deposit transaction
//this function will update the balance once a successful
//deposit transaction occured.
//this function should not allow deposit if amount to deposit is from 100.00 to 400.00
//for the program not to terminate in this case, perform a do while loop to validate the deposit amount and as the user to re enter amount of 500 and/or above .


In pseudocode:


double depositMoney( deposit, &total_balance )
{
     while the user is not entering an amount lower than 100 en larger than 400, keep asking for the amount to be deposited
     if it is between 100 and 400, increase total_balance by the amount of deposit
}


void widrawMoney(double & WMoney);
//this function will simulate withdraw transaction
//balance should be updated once a success withdraw transaction occurred.
//this function should not allow withdrawal if amount to withdraw is less than 500.00
//maximum withdrawal amount is 5000.00
//withdrawal amount should be displayed with the following breakdown: 100,200,500, and 1000


In pseudocode:

void widrawMoney(double & WMoney)
{
    if withdrawal amount is smaller than 5000 and bigger then 500 then:
        use the % operator to break down the amount, for example, 2800:
        2800 / 1000 = 2,  2800%1000 = 800
        800 / 500 = 1, 800%500 = 300
        300 / 200 = 1, 300%200 = 100
        100 / 100 = 1
        Hence, two bills of 1000, one of 500, one of 200 and one of 100 will be presented.
}


That seem to be the main functionalities, the other ones should be fairly straightforward if you've done some basic toying around in c++.

Hope that helps, best of luck with the assignment.

All the best,
NwN
Topic archived. No new replies allowed.