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
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