- We Are Given An Input File Named Prices Txt That Includes In Each Line An Itemnumber Of Type Integer Followed By The 1 (45.94 KiB) Viewed 12 times
We are given an input file named "prices.txt" that includes in each line an itemNumber (of type integer) followed by the
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
We are given an input file named "prices.txt" that includes in each line an itemNumber (of type integer) followed by the
We are given an input file named "prices.txt" that includes in each line an itemNumber (of type integer) followed by the price (of type integer) of that item. We can have up to 500 different items. Also we are given an input file named "sales.txt" such that each line of the file contains two integer values where the first value is the number_of_Items sold of an item (integer) and the second value is the itemNumber. Write C++ statements that compute the total sales of each item based on the information given in the two input files "prices.txt" and "sales.txt". In addition, for each item with total sales larger than zero, the C++ statements output to the screen the itemNnumber followed by the total sales of that item, total sales of an item is calculated as the total number of sales for that item times the price of the item. As an example: If "prices.txt" has the following two lines, where the first lines indicates that item 3 price is 5 and the second line indicates that item 1 price is 10. 35 110 If "sales.txt" includes the following three lines (the first line indicates that the number of items sold is 2 for itemNumber 1, and the second line states that number of items sold is 2 for itemNumber 3, and the last line states another sales transaction of item 1; mainly that that the number of items sold is 4 for itemNumber 1. 21 23 41 Then, for this example, the C++ statements should output to the screen the following two lines, the first line indicates that the total sales of item 1 is 60 AED and the second indicates that the total sales of item 3 equals 10. Item 1 total sales is 60 AED Item 3 total sales is 10 AED