[solved]-Text File Salestxt Contains Data Parts Line Data Except Last Contains Part Name String Cos Q38997603
Using basic and simple C++, (STRUCTS AND ARRAYS)

A text file sales.txt contains data on parts. Each line of data (except the last) contains a part name (string), cost price (double), selling price (double) and quantity sold (integer). There are no more than 50 entries in the file. Also, all text data in the file are in uppercase Data is terminated by a line containing $$$$$ only. Assume that all part names are single words unique. All part names are Sample Data LIGHT 500 600 4 MUFFLER 2000 3000.50 5 WIPER 200 250 8 $$$$$ Write code to read the data from the text file into an array of structs, partsArr, using the following restriction: whenever a record is read, it must be inserted into the array so that the array is always in ascending order of part name. (a) Show all relevant declarations [10 marks] After the array has been loaded, write code that prompts the user for a part name and searches the array for that name using a linear scarch technique. If the name exists in the array, return the profit made by the sale of that part, otherwise, return -1. In the data above, LIGHT made a profit of (600-500) x 4 $400. Note: Use the order to exit quickly if a part is not found in the array. Assume that all parts make a profit when sold (b) Note: Assume that the user’s input is in uppercase. 6 marks] [4 marks Write a function to increase the selling prices of all parts by 35%. (e) Show transcribed image text A text file sales.txt contains data on parts. Each line of data (except the last) contains a part name (string), cost price (double), selling price (double) and quantity sold (integer). There are no more than 50 entries in the file. Also, all text data in the file are in uppercase Data is terminated by a line containing $$$$$ only. Assume that all part names are single words unique. All part names are Sample Data LIGHT 500 600 4 MUFFLER 2000 3000.50 5 WIPER 200 250 8 $$$$$ Write code to read the data from the text file into an array of structs, partsArr, using the following restriction: whenever a record is read, it must be inserted into the array so that the array is always in ascending order of part name. (a) Show all relevant declarations [10 marks] After the array has been loaded, write code that prompts the user for a part name and searches the array for that name using a linear scarch technique. If the name exists in the array, return the profit made by the sale of that part, otherwise, return -1. In the data above, LIGHT made a profit of (600-500) x 4 $400. Note: Use the order to exit quickly if a part is not found in the array. Assume that all parts make a profit when sold (b) Note: Assume that the user’s input is in uppercase. 6 marks] [4 marks Write a function to increase the selling prices of all parts by 35%. (e)
Expert Answer
Answer to A text file sales.txt contains data on parts. Each line of data (except the last) contains a part name (string), cost pr… . . .
OR

