need help writng this program in c++
Below is the output should look exactly the same.
Assignment The transcontinental company you are working for has collected some data offline stored in several text files. In this assignment, you are going to add some functionalities to the program to check those files out. Here is the explanation of the files structure The first row of each file is the header, which shows the four columns' name "Type." "Length." Width" and "Height." respectively, every row shows the type, length, width and height of a specific box. The first column (Type) would be "S" or "C" which stands for Storage room and Crate. Part 1 In the first part of your program, you need to prompt the user to get the file's name, open it up, and check whether the file has been opened successfully or not. The program should keep asking the user to enter the correct file's name if the file is not opened successfully. Here are the steps to follow: 1. Prompt the user to enter a filename and read the file name into a string 2. Open up the file. (You are required to use the string from (1) to open the file up.) 3. Check whether the file is opened successfully or not. If the file has not been opened, output an error and go back to step Check example Part 2 In assignment 4, you applied some restrictions for the box's dimensions. Here is the summary of what you did: Length/width/height of crates should not be greater than 5 and less than 1. Length/widthheight of the storage room should not be greater than 100 and less than 10 Once the file opened. The program starts reading the data from the file. For each row, based on the box's dimensions restrictions, the code checks whether the box's size is acceptable or not. Calculate the volume, surface area, and diagonal of the box. Output the file's data and the calculated values in a nice format. Remember, if the box's dimensions violate the restrictions, the program should output "Inv" for all that box columns Here are the steps to follow 1. Create 2 variables to hold the sum of volumes for both crates and storage rooms 2. Use the cin to read 4 pieces of data from the first line of the file (headers). 3. Use a loop to read the next line of data. 4. Read one row (4 pieces of data) of the file containing the type and the dimensions (length'width/height) of a crate or storage room in that order. 5. Output the row of data read in as shown in the example executions. You will need to check the type of the row. If it is a crate, check each dimension against the min/max crate dimensions. If any dimension violates the crates restrictions, print out "Inv" for the dimension as shown in the example executions. If it is a storage room, check cach dimension against the min/max storage room dimensions. If any dimension violates the storage rooms restrictions, print out "Inv" for the dimension as shown in the example executions. 6. If all of the box's dimensions from (5) are acceptable, use the formulas from assignment 3 to calculate the box's volume, surface area, and diagonal. Then output the results of your calculations using the format in the example executions. If any dimension from (5) is invalid output "Inv" for all 3 calculations 7. Add the calculated volume to its respective running total based on the row's type. 8. Continue from (4) until the end of file is hit. 9. After the program gets to the end of the file, the crates and storage rooms summed volumes should be displayed. 10. Close the file. 11. Prompt the user to continue from the next file. If the user chooses Y/y, the program should continue from part 1 step 1. If the user selects N, the program should terminate. If the user enters anything other than Y/y/N you should output an error message and loop until Y/y/N is entered Error: Invalid file name. Please try again. Please enter an input file name **as6.txt Error: Invalid file name. Please try again. Please enter an input file name **as6_Data.txt TYPE | LENGTH I WIDTH | HEIGHT | VOLUME IS IC IC 1 | Inv 14.0 15.0 | Inv | 5.0 I 3.0 | 100.0 I 2.0 13.3 1 52.0 187.0 1 2.2 | SURFACE AREA | DIAGONAL 100.4 17.3 1 Inv Inv | 76.0 16.7 175.9 1 6.2 | 29692.0 1 128.6 146242.0 | 153.1 162.4 16.0 166.4 1 6.5 Inv Inv 1 98.0 | 78.0 166.0 | | Inv 140.0 144.6 1 331240.0 671814.0 1 31.4 | 30.6 Inv I 65.0 199.0 1 3.1 1 1.6 Inv IS IC | 3.9 Inv IS Inv Total crate volume Total storage room volume Do you want to continue? (Y/y/N) 212.6 .1003054.0 Error: Invalid entry. Please try again. Do you want to continue? (Y/y/N) *** Error: Invalid entry. Please try again. Do you want to continue? (Y/y/N)