This project introduces variables. Variables enable a computer to remember something. A variable is like a post-it note. We use post-it notes in our daily lives to remember something, such as there is a soccer game this weekend. A computer program uses a variable is a similar way. For example, it uses a variable called "answer" to remember the answer a user gave to a question. Or, it can use a variable called "total" to remember the sum of two numbers.
Here is something you can try 1. Notice that the program remembers the sum it calculated the last time it ran. Fix the program so it forgets the previous sum when it is run again. 2. Notice that the program just ads 5 numbers together. It does not ask the user how many to add. Modify the program so it asks the users how many to add. You will need to add another variable. Does it matter if the variable is private or shared? It does not. Why? 3. Next, modify the program to ask the user whether to do addition or substraction. You will need another variable. 4. If you fixed #1, notice that if you select subtraction, the answer is always negative. This happens because the variable used to hold the result of the subtraction is not initialized correctly. What value is the variable before the first subtraction? What value is it after the subtraction? What value did you expect? See the 01-answer project for the solution to this problem. 4. for the experts among us, modify the program so the user enters whether to do addition or substraciton, and then a comma separated list of the numbers. Have the program parse the string to compute the answer. This is not an easy problem - writing parsers can be difficult. You will need to use the operations "length of", "letter of" and "join" to solve this problem. See the 01-answer project for a solution.