The first part to this program will be an implementation of an ATM. This program
ID: 3632701 • Letter: T
Question
The first part to this program will be an implementation of an ATM. This program will allow the user to deposit and withdraw money, as well as checking the activity on their account. Checking account activity consists of printing the account balance and the last five transactions. Account for users who enter lower-case characters instead of upper-case characters. The “check activity” output seen below must be represented exactly as shown below. The following functions must be included in your project and used in the intended manner:void checkActivity (double * theArray, double balance);
void deposit (double cash, double * theArray, double * balance);
void printMenu (void);
void updateTransaction (double * theArray);
void withdraw (double cash, double * theArray, double * balance);
An example run of the first transaction in this system is shown on below. After this, the user will be asked again "What would you like to do?", and so on. User input is in curved brackets { }.
Welcome to the ATM.
Press ‘D’ for a deposit, ‘W’ for a withdrawal, ‘C’ to check activity, or ‘Q’ to walk away.
What would you like to do? {d}
Enter deposit amount: ${45.12}
Your current balance is $ 45.12.
Explanation / Answer
#include #include void checkActivity (double * theArray, double balance); void deposit (double cash, double * theArray, double * balance); void printMenu (void); void updateTransaction (double cash, double * theArray); void withdraw (double cash, double * theArray, double * balance); int main () { printf ("Welcome to the ATM. "); char choice; double balance=0, cash=0, *theArray; theArray = (double *) calloc (sizeof (double), 100); while (choice!='Q' && choice!='q') { printMenu(); scanf ("%c", &choice); if (choice=='D' || choice=='d') { printf ("Enter deposit amount :"); scanf ("%lf", &cash); deposit(cash, theArray, &balance); } else if (choice == 'W' || choice=='w') { printf ("Enter withdrawl amount :"); scanf ("%lf", &cash); withdraw(cash, theArray, &balance); } else if (choice == 'C' || choice=='c') { checkActivity(theArray, balance); } else { } } } void printMenu() { printf ("Press 'D' for a deposit, 'W' for a withdrawal, 'C' to check activity, or 'Q' to walk away. "); printf ("What would you like to do? : "); } void updateTransaction(double cash, double *theArray) { int i; for (i=0; (iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.