I am new at this programming stuff, and functions are confusing to me. I think what I do is replace some of the text from tutorial 5 with functions, but not quite grasping what to do. I have, and will, continue to read more about these to further try to understand this. I practiced some more with what I learned in tutorial 5, and I think I am understanding that, but functions are confusing me. They seem efficient in use and would make the program easier to write, but I am lost right now. What I am trying to accomplish with this tutorial is the same as tutorial 5, but structuring it different by using functions. I will attach what I have so far, some instructions in what I am trying to do, and what the tutorial 5 looks like without functions.
Please put in the form of what is seen in a compiler as it helps me learn better. The instructions say I shouldn't have to modify it too much. The program should run just like tutorial 5; with the user entering a current balance, entering the number of deposits and withdrawals, and then the bank record printing out. Basically, transforming the same output into functions. I will continue to work on it as well.
SOLUTION This solution is FREE courtesy of BrainMass!
Functions are self-contained blocks of code that performs one task efficiently. The solution includes dividing the whole problem into a number of functions that help accomplish the overall task, in this case, an Teller Machine.
The core issues to be careful about are:
1. the function prototypes (that is the signature of each function used in the program) should be declared at the beginning of the code, and they should conform with the actual functions used in the code.
2. the variables passed to the functions should be meaningful in terms of the operation of the function.
3. all functions that are not "void", should return a value to the function which called it. For example, int get_number_of_withdrawals() returns an integer value corresponding to the the number of withdrawals entered by the client/user.
Please see the attached document for the full solution. Thank you for asking BrainMass.© BrainMass Inc. brainmass.com September 27, 2022, 4:41 pm ad1c9bdddf>