Hello! I am a student taking an intro to programming class and I am completely LOST. The assignment is to write a program that simulates an adding machine. I have been working on this for 3 hours and so far I have only been able to get the first line "Enter an integer to add" and then I enter a 1, after that I have nothing. Earlier I got the program to run automatically adding 1 to each line and it was going crazy so I had to stop the program. Can someone help me understand how to do looping for this program? I would greatly appreciate it! Thanks! Pam
Here are the assignment instructions:
"Input to the program will be integers, submitted one per line. Input should be handled as follows: a nonzero value should be added into a subtotal; a zero value should cause the subtotal to be printed and reset to zero; two consecutive zeroes should cause the total of all the values input to be printed and the program to be terminated.
Here is sample output for the game, with the input prompt in blue, the human response in red, and the results in green:
Enter an integer to add: 5
Enter an integer to add: 6
Enter an integer to add: 0
Subtotal: 11
Enter an integer to add: -3
Enter an integer to add: -2
Enter an integer to add: 5
Enter an integer to add: 0
Subtotal: 0
Enter an integer to add: 13
Enter an integer to add: -13
Enter an integer to add: 8
Enter an integer to add: 0
Subtotal: 8
Enter an integer to add: 0
Total: 19
Also, don’t forget test your program on input that consists of only two zeroes—the output should be a 0 subtotal and a 0 total. Here's an example:
Enter an integer to add: 0
Subtotal: 0
Enter an integer to add:0
Total: 0 "