Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the program in C with comments- Bank simulation Assignment purpose: User defined functions, pointer arguments, Menu driven program You will write a program that

Write the program in C with comments-

Bank simulation Assignment purpose: User defined functions, pointer arguments, Menu driven program You will write a program that will simulate the management of money in 3 accounts: checking, savings, and credit General Requirements: A preprocessor directive must be used to define a MAXCREDIT of -4500 DO NOT declare any pointers for this assignment DO NOT use global variables DO NOT use break statements to stop loops Use function prototypes. Write comments for each function before each prototype and again before each function definition. Be sure to comment your code adequately. Be sure to indent properly. Check the course textbook and lecture code examples to see how it should be done. Use meaningful variable names. NOTE: To transfer between accounts, you need to make a withdraw followed by a deposit Your starting bank balances should be as follows: o Checking: 480.45 o Savings: 124.62 o Credit: -2134.78 You must have at least 6 user defined functions as follows: o No modifications may be made to the functions #define _CRT_SECURE_NO_WARNINGS #include #define MAXCREDIT -4500 // Displays the list of options available //prompts for the users selection and sets the value of the selection void RunBankChoices(int *choice); //greets the user void Greeting(); //Takes one double argument and one character argument //displays the current balance of the account ('C' checking, 'S' savings, 'R' credit) void AccountBalance(double account, char letter); //takes reference to all the bank account money values and the menu selection //Makes the decsion of which trnsaction should be done void TransactionDecision(int num, double *cPtr, double *sPtr, double *rPtr); //takes a reference to the selected account balance //gets the added amount from the user and adds it to the account void DepositMoney(double *accountPtr); //takes a reference to the selected account balance //gets the withdrawal amount from the user //checks to see if there is enough money available OR enough credit available //subtracts the money from the account if available void WithdrawMoney(double *accountPtr, char letter);

Sample output: ******************************* Welcome to the Bank of COP 2220 It is a pleasure to manage your checking, savings, and credit accounts -- You currently have $480.45 in your checking account -- You currently have $124.62 in your savings account -- You currently have $-2134.78 credit balance ------------------------ (1) to DEPOSIT to CHECKING (2) to WITHDRAW from CHECKING (3) to DEPOSIT to SAVINGS (4) to WITHDRAW from SAVINGS (5) to DEPOSIT to CREDIT (6) to TAKE an ADVANCE from CREDIT (7) for all ACCOUNT BALANCES (-1) QUIT Select an option: 2 The transaction you chose was: 2 Withraw from Checking -- You currently have $480.45 in your checking account Enter the amount to be Withdrawn: 400 -- You currently have $80.45 in your checking account ------------------------ (1) to DEPOSIT to CHECKING (2) to WITHDRAW from CHECKING (3) to DEPOSIT to SAVINGS (4) to WITHDRAW from SAVINGS (5) to DEPOSIT to CREDIT (6) to TAKE an ADVANCE from CREDIT (7) for all ACCOUNT BALANCES (-1) QUIT Select an option: 3 The transaction you chose was: 3 Deposit to Savings -- You currently have $124.62 in your savings account Enter the amount to deposit: 400 -- You currently have $524.62 in your savings account ------------------------ (1) to DEPOSIT to CHECKING (2) to WITHDRAW from CHECKING (3) to DEPOSIT to SAVINGS 3 (4) to WITHDRAW from SAVINGS (5) to DEPOSIT to CREDIT (6) to TAKE an ADVANCE from CREDIT (7) for all ACCOUNT BALANCES (-1) QUIT Select an option: 6 The transaction you chose was: 6 Take out more Credit -- You currently have $-2134.78 credit balance Enter the amount to be Withdrawn: 3000 *** There is not enough credit available for this transaction *** The Maximum credit allowed is $-4500.00 *** Contact customer service about raising your Credit Line -- You currently have $-2134.78 credit balance ------------------------ (1) to DEPOSIT to CHECKING (2) to WITHDRAW from CHECKING (3) to DEPOSIT to SAVINGS (4) to WITHDRAW from SAVINGS (5) to DEPOSIT to CREDIT (6) to TAKE an ADVANCE from CREDIT (7) for all ACCOUNT BALANCES (-1) QUIT Select an option: 7 The transaction you chose was: 7 Show account balances -- You currently have $80.45 in your checking account -- You currently have $524.62 in your savings account -- You currently have $-2134.78 credit balance ------------------------ (1) to DEPOSIT to CHECKING (2) to WITHDRAW from CHECKING (3) to DEPOSIT to SAVINGS (4) to WITHDRAW from SAVINGS (5) to DEPOSIT to CREDIT (6) to TAKE an ADVANCE from CREDIT (7) for all ACCOUNT BALANCES (-1) QUIT Select an option: -1 The transaction you chose was: -1 Press any key to continue . . .

** build run and test 5. Write the function prototype, function definition, and function call for the Greeting function *** build run and test

6. Write the function prototype, function definition, and function call for the RunBankChoices function, (you will need to declare an integer variable in main to pass the address of that variable to the function call

7. Add a printf statement in the main function to test *** build run and test

8. Now it is time to create the loop that allows the user to continue to make transactions, a choice of -1 will stop the loop, remember to initialize choice

9. The function call to RunBankChoices goes inside the loop body *** build run and test with the loop try entering different numbers, make sure -1 stops the loop

10. Now it is time to add the account balances, you will need three double variables in the main function, checking, savings, credit. The variables should be initialized to the values described in the assignment instructions.

11. Write the function prototype, function definition, and function call for the AccountBalance function, this function will make copies of the amount of money in an account and will need a character to know which account balance is getting displayed, use conditions to test the character.

12. Make 3 function calls to AcountBalance (one for each account type) from the main function, after the Greeting and before the loop. *** build run and test, you should see the beginning balances displayed after the Greeting

13. Write the function prototype, function definition, and function call for the TransactionDecision function, there will be nested conditions in this function, add printf statements inside the function

14. Call the function from inside the loop in the main function, pass it the address of the 3 doubles that store the amount of money in the accounts

15. You will eventually be calling the DepositMoney , WithdrawMoney, and AccountBalance from inside this function. Right now just add printf statements to indicate where these function calls will be made. *** build run and test

16. Now it is time to write the function prototype, function definition, and function call for the DepositMoney function, you will call this function 3 times from inside the TransactionDecision function, once for each account type also call the AccountBalance before the deposit and after the deposit *** build run and test

17. Now it is time to write the function prototype, function definition, and function call for the WithdrawMoney, function, you will call this function 3 times from inside the TransactionDecision function, once for each account type also call the AccountBalance before the withdraw and after the withdraw *** build run and test

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions