Question: 4 . 8 . 1 : Rearrange code into a solution with a reusable helper method. Full screen Consider the following simple program segment and
: Rearrange code into a solution with a reusable helper method.
Full screen
Consider the following simple program segment and note how repetitive it is to prompt for the inputs.
public static void mainString args
Scanner in new ScannerSystemin;
System.out.printFirst item: ;
double price innextDouble;
System.out.printNext item: ;
price price innextDouble;
System.out.printTax rate in percent: ;
double rate innextDouble;
double tax price rate ;
System.out.printlnAmount due: price tax;
Rearrange these lines of code into an alternate solution with a reusable helper method.
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
