(Your last one!!!)

This program is similar to programming assignment #5:  Data error checking for all inputs as in #5.  Your program is to behave in the exact same manner as assignment #5, however how you structure your code is a different story. Now we will use functions.

Recall Assignment #5:

Write a C program that allows the user to make some banking transactions. The program should first prompt the user to enter the current balance of his/her bank account (in dollars and cents). The program should then prompt the user to enter the number of deposits to make, and then the number of withdrawals to make. For this assignment, let's set a maximum of 50 deposits and 50 withdrawals.  (etc.)

Here is the change for program #5: There should be at least three non trivial functions in the program! (by that I mean a function that does more than just print a line of text).  For example, one function may be to find out how many deposits will be entered, , or the opening balance, or the message before the bank record. etc.  

Hints: Your code from assignment #5 does not need to be modified too much to solve this problem. The algorithm is the same.  Outputting the contents of the arrays in "record form" is pretty straightforward, and should be done in a loop.  (This could be a good place for a function.)  If you cannot put your assignment #5 into shape easily – you should start with my version of #5, and then transform it into functions.  You may take the concepts from my answer to problem #5, but please do not copy mine verbatim(i.e. change some variable names etc.).

For example: You can use void as the function type and use an argument(s)  (e.g.  you can have  void print_deposits_out ( float deposits [ ], int number_of_deposits) as a prototype.)  And you could use a similar one for the withdrawals.  Or, you could put the comment before the bank record into a function by sending the closing balance into the function. Furthermore, if you use more than three functions, I will grant you some minor errors that I would normally take off for(-2 or -3 points) for each function used (to a maximum of 100 for a grade).  Now that's an incentive! 
Powered by