In Python Adding Calculator Write a program that simulates an adding machine. Input to the program will
Fantastic news! We've Found the answer you've been seeking!
Question:
In Python
Transcribed Image Text:
Adding Calculator Write 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. Beginning of output: 6 59 subtotal: 11 0 -3 -2 5 0 13 subtotal: 0. -13 8 0 subtotal: 8 0 total: 19 End of Output 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: 0 subtotal: 0 0 total: 0 Adding Calculator Write 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. Beginning of output: 6 59 subtotal: 11 0 -3 -2 5 0 13 subtotal: 0. -13 8 0 subtotal: 8 0 total: 19 End of Output 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: 0 subtotal: 0 0 total: 0
Expert Answer:
Answer rating: 100% (QA)
It appears that the question image contains incomplete information The image describes the requireme... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these databases questions
-
Microkernel operating systems aim to address perceived modularity and reliability issues in traditional "monolithic" operating systems. (i) Describe the typical architecture of a microkernel...
-
An algorithm has been written in pseudocode to input some numbers. It only outputs any numbers that are greater than or equal to 100. The number 999 is not output and stops the algorithm. INPUT...
-
1. Read the following article about the new circle with disney product and answer the following questions. in doing so, take on the role as the marketing manager responsible for the product and...
-
Journalize the following transaction in correct form: 201X Apr. 1 Sold merchandise on account, $1,180. The merchandise cost $740.
-
How can an independent retailer overcome the problem of little computerization?
-
Express the response of a single-degree-of-freedom system using the Duhamel integral.
-
What effect does organizational structure and compensation have on ethical behavior among chief executives at ARC? The American Red Cross (ARC) is an independent organization, supported by public...
-
4) Determine what the force of friction, net force, and a will be for each of the given situations at right. fn=196N FA Fr a 98.0 N 100.0 N m = 20.0 kg 120.0 N 122.0 N k = 0.50 s = 0.62 150.0 N Fg =...
-
Shareholders sometimes pursue selfish strategies such as taking large risks or paying excessive dividends. These actions generally result in: O no action by debtholders since these are shareholder...
-
Describe three distinct mechanisms for accomplishing dosage compensation in different species.
-
A human disease known as vitamin Dresistant rickets is inherited as an X-linked dominant trait. If a male with the disease produces children with a female who does not have the disease, what is the...
-
An allele in Drosophila produces a star-eye trait in the heterozygous individual. However, the star-eye allele is lethal in homozygotes. What would be the ratio of phenotypes of surviving offspring...
-
What structural feature allows DNA to store information?
-
Describe the molecular process of X-chromosome inactivation. This description should include the three phases of inactivation and the role of the Xic. Explain what happens to the X chromosomes during...
-
From the newspapers, newsmagazines, radio and television broadcasts, and Internet discussions of the past week, find five examples of quasi-policy propositions currently being debated in Congress or...
-
What are the 5 Cs of marketing channel structure?
-
Complete and fully test the class Characteristic that Exercise 5 describes. Include the following methods: getDescriptionreturns the description of this characteristic. getRatingreturns the rating of...
-
Write a recursive method that will compute the sum of the digits in a positive number.
-
Write a default constructor and a second constructor for the class RatingScore, as described in Exercise 9 of the previous chapter. Exercise 9 Consider a class RatingScore that represents a numeric...
-
What are vertical and horizontal financial statement analyses? What are their advantages?
-
Which form of financing requires repayment, regardless of whether the company receiving the funds does well or not? a. A loan b. An investment c. Both a loan and an investment d. Neither a loan nor...
-
Which form of financing allows the source of the funds to share in the wealth if the company which received the financing does well? a. A loan b. An investment c. Both a loan and an investment d....
Study smarter with the SolutionInn App