Question: needs to be in java Write and submit a program that simulates an adding machine. Input to the program will be integers, submitted one per

needs to be in java
needs to be in java Write and submit a program that simulates
an adding machine. Input to the program will be integers, submitted one
per line. Input should be handled as follows: 1. a nonzero value

Write and submit a program that simulates an adding machine. Input to the program will be integers, submitted one per line. Input should be handled as follows: 1. a nonzero value should be added into a subtotal; 2. a zero value should cause the subtotal to be printed and reset to zero; 3. two consecutive zeroes should cause the total (not subtotal) of all the values input to be printed and the program to be terminated. Here's an example of how the program should work. Input is in red and output is in blue. Test Case 1: 01 subtotal: 1 0 total: 1 Test Case 2: 5 6 0 subtotal: 11 3 2 5 0 subtotal: 0 13 13 8 0 subtotal: 8 0 total: 19 Test Case 3: 8 0 subtotal: 8 8 0 subtotal: 8 8 0 subtotal: 8 8 0 subtotal: 8 8 0 subtotal: 8 0 total: 40 Don't forget to test your program on input that consists of two zeroes-the output should be a 0 subtotal and a 0 total - as well as on the example above. Here's an example: Test Case 4 : 0 subtotal: 0 Notes: 1. Begin by uploading the file starter file provided in Mimir

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!