Question: ( 4 0 pts ) This problem deals with reading input from the keyboard and files and applying simple arithmetic calculations. Create class ProductCumulator with
pts This problem deals with reading input from the keyboard and files and applying simple arithmetic calculations. Create class ProductCumulator with the following methods and steps:
i void ProductFromKeyboard:
Step : Outputs the following: "Please input a series of positive ints, using the
Step : Takes a sequence of input positive integer values from the keyboard and multiplies them together until a zero or negative integer is encountered.
Step : Prints the product of all positive values provided in Step if none are provided, is output.
Ex: If the following is input from the keyboard:
then the output should be along the lines of "The product of input values is
ii void ProductFromFileString filename:
Identical to ProductFromKeyboard, but must take the sequence of integers from the file defined according to filename. You can assume that i only integer values will be provided and ii at least one nonpositive value will be provided in the file. You can and should stop immediately as soon as the nonpositive value is seen. Ex: if the included file "sampleintsequence.txt is given as input, the output should be along the lines of "The product of input values is
Note: You will want to refer to the last part of chapter s slides and code for insight into reading input with Java. You will also require if statements.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
