Please Help! C++ ATM Machine

I'm trying to write a program for my Computer Science class but I'm completely lost.Can someone please help me? In this program, you will implement a magical piggy bank. This piggy bank has several features that are not usually found in most piggy banks. It will automatically convert your coins to the next highest denomination. For example if you insert 21¢ (2 dimes and 1 penny) to a balance of 4¢, it will convert the new balance to one quarter. When you make a withdrawal, the piggy bank will convert to the necessary currency for you. The program will present the following menu to the users with the current balance in a nicely formatted table as shown in the screen shots below.
1) Make a deposit.
2) Make a withdrawal.
3) View Coins.
4) Exit the program.
Option 1:
1) The user will enter a currency value to be added into the bank, such as: 3.01
2) Negative amounts are not allowed; if the user enters a negative value, display
an error message.
3) The piggy bank can only hold up to 900.00 dollars. If the user’s deposit
will exceed this amount, display an error message and inform the user how much money can be deposited.
Option 3:
deposited. If the user asks for more money than is in the bank, display an error message and inform the user how much money can be withdrawn (the current balance.)
Will allow the users to view statistics of the piggy bank.
Will allow the user to insert money into the piggy bank.
Option 2:
1) The user will enter a currency value to be removed from the bank, such as:
Will allow the user to remove money from the piggy bank.
2.57
2) Negative amounts are not allowed; if the user enters a negative value, display
an error message.
3) The piggy bank is not capable of giving out more money than has been
1) You will display the name of the coin, quantity of coin, total value of the coin.
2) The piggy bank can hold only quarters, dimes, nickels and pennies.
3) Present information to the user in a nicely formatted table as shown in the
screen shots below.
Note: Your statistics may be off by one penny compared to the account balance. Do not panic if it happens. It is caused by rounding and you will not lose points.
Option 4: Exit the program with a message
You must display an error message if the user enters an option not specified in the menu. You may assume that all options entered will always be an integer value.
You may assume that all currency values will be valid currency amounts. We will not test programs by entering values such as: 27.655 dollars.
You must store the balance information in a floating point variable. Do not deviate from the menu structure given above; use only values 1-4 as menu choices.
This is as far as I've gotten

#include <iostream>
using namespace std;
int main ()
{
int choice, withdraw, deposit;
float amount = 0.00, new_amount = 0.00;
cout << ("\n\n");
cout << ("\n\t***********************************");
cout << ("\n\t* MENU *");
cout << ("\n\t* 1. Make Deposit *");
cout << ("\n\t* 2. Make Withdraw *");
cout << ("\n\t* 3. View Coins *");
cout << ("\n\t* 4. Exit *");
cout << ("\n\t* *");
cout << ("\n\t***********************************");
cout << ("\n\n");
cout << ("Enter your choice: ");
cin >> (choice);

if (choice == 1)
{
cout << ("Enter the amount you want to deposit: ");
cin >> deposit;
amount = amount + deposit;
cout << "Current balance on your account: " << amount;
}
else if (choice == 2)
{
cout << ("Enter the amount you want to withdraw: ");
cin >> withdraw;

if (withdraw > amount)
{
cout << ("You don't have sufficient balance");
}
else
{
new_amount = amount - withdraw;
cout << ("Current balance on your account: %f\n", new_amount);
}
}

else if (choice == 3)
{

}
else if (choice == 4)
{
cout << ("Thank you for using our service");
}
else
{
cout << "Invalid choice";
}
return 0;
}
xory in the event that it would seem that i'm asking yet i'm simply asking how cuz im a beginner with regards to c++, the connection you gave me, i see that the codes are java in case i'm ryt,, at any rate we havent achieve that point yet, all i'm approaching is for a basic ATm machine , really im practically done however the issue is it end after i'm finished with first alternatives, case i could sign in for the orret watchword, atm machine will give four choices,

on the off chance that i pick deposit,example i store 5000, it will provoke for what i store which is 5000 and in the meantime, it will incite 15000 as the aggregate sum since i proclaimed my underlying equalization as 10000


visit here : http://www.bestessaywritingservice.co/
Some pointers:
- When you post code, after you pasted the code, select all of it and click the "<>" button to have it shown as code (with line numbers and so on). This makes it easier to refer to your code.

- At present your code stops after the first costumer, because the balance always starts at 0 and users have to choose option 1 or 2.

I would recommend having a look here:
https://www.tutorialspoint.com/cplusplus/cpp_while_loop.htm
and here:
http://www.cplusplus.com/doc/tutorial/functions/

- I would move all the code that gets executed if option 1 is selected to a function and all the code that is executed if option 2 is selected to another function. This will make your main function a lot easier to understand.

Finally I would place all the code except the variable declaration in the main function in a while loop, so that when one costumer is done, the ATM is ready for the next visit.
Last edited on
Topic archived. No new replies allowed.