Menu

[Solved]Create Functional Atm Using Code Base Given Example Must Use Routines Provided Code Base E Q37288537

Create a functional ATM using the code base given in theexample. You must use the routines provided in the code baseexample. ( C Programming Language Please ) “Type “

/* * @desc: Simple ATM machine * @duedate: 23-April-2019 * * * */ #include <stdio.h>#include <time.h>#include <stdlib.h>#include <string.h>char menu();char transaction_menu();/* Verifies the Pin Entered match the PIN on record */int validatePin(int);/* Verifies the funds requested are available to perfrom the transaction * 0 – Ok to perform transaction, 1 – funds not available */int verify(double, double);/* Each of the following routines should update a specific balance * after the transaction has been completed */double chk_deposit();double chk_withdraw();double sav_deposit();double sav_withdraw();void transfer(double, double);int validatePin(int pin){ int entered_pin =0; printf(“Enter PIN “); scanf(“%d”, &entered_pin); return entered_pin != pin; /* if (entered_pin != pin){ return 1; } return 0; */}char transaction_menu(){ char c; printf(“S – SAVINGttC – CHECKINGn”); printf(“Enter Choice:”); scanf(” %c”, &c); if (c == ‘S’ || c = ‘s’){ return ‘S’ } else{ return ‘C’; }}char menu(){ char c; printf(“———————– MENU ——————–n”); printf(“C – CHECK BALANCEttD – DEPOISTn”); printf(“T – TRANSFERtttW – WITHDRAWn”); printf(“Y – ANOTHER TRANSACTIONttE – ENDn”); printf(“Enter Choice:”); scanf(” %c”, &c); return c;}int main(){ char choice, t_choice; srand(time(NULL)); int pin = rand() % 9999; int acct_num = rand() % 99999; double chk_acct_bal = rand() % 99999; double sav_acct_bal = rand() % 99999; printf(“PIN: %dn”, pin); printf(“Account#: %dn”, acct_num); printf(“Checking Balance: %.2fn”, chk_acct_bal); printf(“Saving Balance: %.2fn”, sav_acct_bal); if ( validatePin(pin) == 1){ printf(“Oops you messed up….”); return 1; } while(choice != ‘E’){ choice = menu(); printf(“Choice: %cn”, choice); if (choice == ‘E’){ printf(“Have a nice day, bye.”); return 0; } if (choice == ‘D’ || choice == ‘W’){ t_choice = transaction_menu(); printf(“Transaction Choice: %cn”, t_choice); } if (choice == ‘T’){ printf(“Transfer: %cn”, choice); } } }

Expert Answer


Answer to Create a functional ATM using the code base given in the example. You must use the routines provided in the code base e… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *