Question: Create a program called priceFinder.cpp that will that will allow the user to enter the name of a product and up to 10 item prices.
Create a program called priceFinder.cpp that will that will allow the user to enter the name of a product and up to 10 item prices. Your program must store the item prices in an array. You can assume the following: The user will not use spaces when entering the product name. The user will provide the item prices as floating point numbers. If the user provides -1 for an item price, then your program should stop accepting more item prices and calculate the following using one or more functions that you create: Number of valid item price (i.e price greater than 0). Maximum item price. Minimum item price. Average item price. Item price range (calculated as maximum - minimum). Print the output of each calculation to the screen, a sample output is provided on the next page. Once your program has calculated and displayed the number of valid prices, maximum, minimum, average, and range you should ask the user to provide a new product name and continue the process. If the user enters DONE as a product name your program should terminate.
Welcome to the price finder program. Enter a product name: Oreos Enter price: 2.5 Enter price: 2.25 Enter price: 2.75 Enter price: -1 Number of valid prices: 3 Maximum: $2.75 Minimum: $2.25 Range: $0.50 Average: $2.50 Enter a product name: Milk Enter price: 1.8 Enter price: 2.2 Enter price: 1.9 Enter price: 1.7 Enter price: -1 Number of valid prices: 4 Maximum: $2.20 Minimum: $1.70 Range: $e.50 Average: $1.90 Enter a product name: DONE Thank you for using the program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
