Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started