I will give you a file inventory.txt The file will have the following specifications: Each record consists of two lines. The first line contains the name of the product, which may be more than one...


I will give you a file inventory.txt


The file will have the following specifications:


Each record consists of two lines.


The first line contains the name of the product, which may be more than one word long.


The second line contains the wholesale price as a decimal, the markup as a percentage, and three quantities, for counter, shelf, and warehouse.


If the first line of a record contains the word END all by itself, that is the end of the file.



Your task, in c++, is to read each record into the program, as a string for the name, and numbers for the price and markup, and as an array of numbers for the quantities.


Then calculate the total profit for each item: (wholesale price) * (markup, converted into a decimal) * (total quantity).


Print out a report on one line for each item: Name, total profit.


Format the output nicely: names should fit in 30 characters and the prices should line up and should have two decimal places.



Hints:


You’ll want to use getline to read multi-word product names.


You’ll want to consider what kind of array to use for quantities – do you have fractional quantities or whole numbers?


You’ll want to review section 6.2 for how to produce a nicely formatted output.



Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here