Question
Problem: (C++ please) You have been asked to use your programming skills to help analyze data from a company name Resistors-R-Us. This company has different
Problem: (C++ please) You have been asked to use your programming skills to help analyze data from a company name Resistors-R-Us. This company has different locations producing resistors with different formulas. They have automated the data collection so that the resistances are stored in a file containing a table (2-D array). Each row of the table represents a specific formulation and each column represents a specific company location. Your program should have a main function and 4 other functions as described below. The company has stated that there will not be more than 80 formulations and not more than 10 locations using the same formulations. One function should open the file Resistors-R-Us.dat and read the first line that contains the number of formulations (the first value) and number of locations (the second value) using those formulations. Using these two values, your function should then read the rest of the data and store the values in a 2-dimensional array with formulations in rows and the locations in columns. As the resistances are being stored, a message should be output if any resistance is not in the range of 3 to 3.5 inclusive and the number of resistances not in the range should be counted. The message should output the resistance, the location and the formulation as the example below. The value of 2.9427 ohms from location 1 for formulation 6 is suspect. The resistance should still be stored in the array. The 2-dimensional array, the number of formulations and the number locations should be sent back to the function call. The number of resistances not in the range of 3 ohms to 3.5 ohms inclusive should be returned to the function call. One function should accept the 2-dimensional array, the number of formulations and number of locations then create a 1-dimensional array containing the minimum resistances for each formulation and create a 1-dimensional array containing the maximum resistances for each formulation. This function should call the function to output a 1-dimensional array once for the minimum and once for the maximum values before sending these arrays back to the function call. One function should accept the 2-dimensional array and determine the average resistance for each formulation. The average resistance for each formulation should be calculated without including the maximum and minimum resistance for that formulation, therefore this function will need to call the function that calculates the minimum and maximum resistances for each formulation. The average resistances for the formulations should be stored in another 1 dimensional array which is sent back to the function call.
One function that will accept a 1-dimensional array, the number of values stored in the array and a description of what is stored in the array, e.g minimum resistance for each formulation, average resistance for each formulation, etc. The function will then output the description and the values. The values should be output to 4 significant digits; The main function should prompt the user to enter the filename for the data file and call the function to import the data from the file into a 2-dimensional file. The main function should output the number of formulations (rows), the number of locations (columns), and the number of resistances that were not in the correct range. Next the main function should call the function to calculate the averages of the formulations. The main function should then call the function to output a 1-dimensional array sending the array of averages to the function to calculate the 1dimensional array. A data file, Resistors-R-Us.dat has been posted on CANVAS. However, you should create your own file with fewer formulations and locations to test your code.
Below is the first 9 lines of values from the file:
35 8
3.3884 3.1033 3.2681 3.2889 3.0943 3.3539 3.3666
3.2853
3.2437 3.0874 3.3767 3.1344 3.4415 3.3411 3.3713
3.3217
3.2949 3.0535 3.2249 3.2540 3.3110 3.2260 3.2986
3.1195
3.2137 3.5105 3.2295 3.2049 3.1852 3.2681 3.3526
3.1494
3.1479 3.3472 3.0298 3.2609 3.5117 3.2744 3.3371
3.3291
2.9427 3.2757 3.1725 3.2249 3.3051 3.2596 3.2118
3.2383
3.3126 3.1526 3.1107 3.2310 3.2794 3.1670 3.2929
3.3053
3.2213 3.1354 3.2114 3.1467 3.1722 3.2148 3.2201
3.1539
3.2303 3.3048 3.3026 3.2177 3.1435 3.2325 3.1600
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started