Question
C++ ATM; recoding help. (Visual Studio) I have already posted this question on Chegg, but it seems like the code is too complicated than it
C++ ATM; recoding help. (Visual Studio)
I have already posted this question on Chegg, but it seems like the code is too complicated than it supposed to be. ( This is just a beginners class so I do not need any of these libraries except #include
I would like the code to be simpler. ( Like cin.ignore(numeric_limits
I'll post the code at the very bottom.
Also, this is the prompt we are using.
#include
#include
#include
# include
using namespace std;
//main function
int main() {
//variables to store users choices and amounts
char choice;
double with, depo, result, bal;
string accno;
//printing welcome message
cout
cout
cout
cout
//getting the account number from user
cout
getline(cin, accno);
//checking whether account number equals to shutdown keyword
if (accno == "shutdown") {
cout
return 0; //terminating the program
} else {
//if the account no is valid, then reading the balance from the user
cout
cin >> bal;
cin.ignore(numeric_limits
//displaying the menu options
cout
cout
cout
cout
cin >> choice;
//reapetadily asking the user for correct choice
do{
cout
cin >> choice;
}while(choice != 'D' && choice != 'B' && choice != 'W');
}
if (choice == 'B') {
//Displaying the account details
cout
cout
cout
cout
cout
}
if (choice == 'D') {
//getting the user deposit amount and storing into account
cout
cin >> depo;
cout
cout
cout
cout
cout
cout
bal = bal + depo;
cout
}
if (choice == 'W') {
cout
cin >> with;
while (with > bal) {
cout
cout
cin >> with;
}
bal = bal - with;
//displaying the account info
cout
cout
cout
cout
cout
cout
cout
}
return 0;
}
Project 1: ATM Learning Objectives: Use of the following to solve a problem C++basic data types, variables, assignments, arithmetic -user input/output - decisions basic loops General Description Write a C++ program that simulates the function of an ATM machine. For each transaction, the program asks the user to enter their current account number and balance (unrealistic, but we don't know how to read data from files yet) displays a menu of transaction options - - asks the user to choose an option, forcing them to enter a correct option - depending on the option chosen, asks for more information performs the calculations for the transaction prints the calculated amounts as a "receipt". The program repeats the above steps continuously until the user enters shutdown for the account number. This is a signal for the ATM to shut down (end program)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started