We are given an input file named "prices.txt that includes in each line an itemNumber (of type integer) followed by the

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
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

Post by answerhappygod »

We Are Given An Input File Named Prices Txt That Includes In Each Line An Itemnumber Of Type Integer Followed By The 1
We Are Given An Input File Named Prices Txt That Includes In Each Line An Itemnumber Of Type Integer Followed By The 1 (51.84 KiB) Viewed 10 times
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 0, 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 number 3 price in 5 and the second line indicates that item number 1 price is 10. 35 1 10 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 dem number 1; mainly it states 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 number 1 is 60 AED and the second indicates that the total sales of item number 3 equals 10. Item 1 total sales is 60 AED Item 3 total sales is 10 AED Notes: Do not add statements to declare, open, or close the files. We assume this is already done Response Feedback: [None Given]
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply