Question: Create a java program which will prompt a user to input a product and its cost. Using a while loop that will run until the
Create a java program which will prompt a user to input a product and its cost. Using a while loop that will run until the sentinel value of stop (any case) is entered, the program will look for items with a cost greater than or equal to $100.00. The program will find the average cost of those items.
Note: immediately after your statement containing input.nextDouble() you will need to add the following input.nextLine() statement. This will cause the input scanner to consume the newline after your product cost. Otherwise, your program will skip the next input statement. The code should look like this:
productCost = input.nextDouble(); input.nextLine(); // Consume newline
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
