Intro to Programming in C – Program 2 – The Bank Assignment purpose: User define
ID: 3865227 • Letter: I
Question
Intro to Programming in C – Program 2 – The Bank Assignment purpose: User defined functions, pointers, Menu driven program General Requirements: Use the function prototypes provided Assume correct data types for input Comments for each function appear before each prototype and again before each function definition. Be sure to comment your code adequately. Be sure to indent properly. Check the textbook and lecture code examples to see how it should be done. Use meaningful variable names. Starting bank balances should be as follows:
o Checking: $ 650.00
o Savings: $ 800.00
o Credit: $ -700.00
You must use the user defined functions as follows:
o No modifications may be made to the functions
#define _CRT_SECURE_NO_WARNINGS
#define CREDITLIMIT 3000
// Displays the list of integer options available
//prompts for the user’s choice and sets the value of the choicePtr
void RunChoices(int *choicePtr);
//Asks if they want another transaction //sets the value of againPtr to (y or n)
void MakeTransaction(char *againPtr);
//Asks the user which type of account they would like to access and sets the
//value of the the character accountPtr
void SelectAccount(char *accountPtr);
//Prompts the user for the amount to deposit
//and adds that value to the amount in the bank account
void AddMoney(double *moneyPtr);
//Prompts the user for the amount of the withdrawal, determines if there are
//sufficient funds and updates the selected account if funds are dispensed
void RemoveMoney(double *moneyPtr, char account);
//Displays the user’s current account balance for all three accounts
void DisplayBalance(double checking, double savings, double credit);
Explanation / Answer
#define _CRT_SECURE_NO_WARNINGS #include #define MAXCREDIT -4500 void RunBankMenu(int *choice); void Greeting(); void AccountBalance(double account, char letter); void TransactionDecision(int num, double *cPtr, double *sPtr, double *xPtr); void DepositMoney(double *accountPtr); void WithdrawMoney(double *accountPtr, char letter); int main() { double checkings = 430.00; double savings = 812.00; double credit = -2254.00; int NumberChoice = 0; Greeting(); AccountBalance(checkings, savings, credit); RunBankMenu(&NumberChoice); printf("%d", NumberChoice); } void Greeting() { printf("Welcome to the Bank of COP 2220 It is a pleasure to manage" " your checking, savings, and credit accounts "); } void AccountBalance(double account, char letter) { double checkings = 430.00; double savings = 812.00; double credit = -2254.00; printf("-- You currently have $%.2f in your checking account ",checkings); printf("-- You currently have $%.2f in your savings account ",savings); printf("-- You currently have $%.2f credit balance ", credit); } void RunBankMenu(int *choice) { do{ printf("----------------------------- "); printf("(1) to DEPOSIT to CHECKING "); printf("(2) to WITHDRAW from CHECKING "); printf("(3) to DEPOSIT to SAVINGS "); printf("(4) to WITHDRAW from SAVINGS "); printf("(5) to DEPOSIT to CREDIT "); printf("(6) to TAKE an ADVANCE from CREDIT "); printf("(7) to TRANSFER MONEY BETWEEN ACCOUNTS "); printf("(8) for all ACCOUNT BALANCES "); printf(" (9) QUIT "); printf("Select an option: "); scanf("%d", &*choice); } while (*choiceRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.