subject

Given a data file, find the max, min, and average values of columns. Also, create an addition column that is based on the other columns. There will be no error checking required for this lab. You are provided with a data file named (surprise!) data .txt. Data is arranged in columns where each item of data is twelve columns wide (so it is easy to extract data items using slicing)
Your task is read the file data. txt and calculate the max, min, and average of the height and weight columns and to add an additional column that has the BMI calculated based on each height and weight. Your output will look like this (and needs to be formatted like this). To match the testing on Mirmir here is the format string:
The formula for BMI is simple in the metric system:BMI = weight/height ** 2
How do we find the max and min?
The basic concept is similar to counting that you have done multiple times:initialize a value before a loop and the update the value every time through the loop.
Based on that concept here is the algorithm to find the minimum of a set of values:
1. Initialize minimum to be much larger than any data value in your data, e. g. 10**6.
2. When you consider each data item, if the data item is smaller than the current minimum, you have a new minimum (so update it).
3. After considering all data items your minimum will contain the smallest.
The algorithm to find the maximum is a tiny variation.
To find the average, add up all the values and count how many values there are. Divide those two to get the average.
1. Begin by simply opening the file and printing every line - now you know that you are correctly working with the correct file.
2. Next ignore the header line-use either readline () before the loop or continue in the loop.
3. Next find the average of a column:collect a total and count, remembering to initialize before the loop.
4. Next find the minimum of a column using the algorithm above.
5. Continue in such small increments to do the remainder of the program.

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 22:00, noeminm105
Consider the following declarations (1, 2, 3, 5, 7)class bagtype{public: void set(string, double, double, double, double); void print() const; string getstyle() const; double getprice() const; void get(double, double, double, double); bagtype(); bagtype(string, double, double, double, double); private: string style: double l; double w; double h; double price; }; a.) write the definition of the number function set so that private members are set according to the parametersb.) write the definition of the member function print that prints the values of the data membersc.) write the definition of the default constructor of the class bagtype so that the private member variables are initialized to "", 0.0, 0.0, 0.0, 0.0, respectively d.) write a c++ statement that prints the value of the object newbag. e.) write a c++ statement that declares the object tempbag of type bagtype, and initialize the member variables of tempbag to "backpack", 15, 8, 20 and 49.99, respectively
Answers: 3
image
Computers and Technology, 23.06.2019 09:50, tatumleigh04
Allison and her group have completed the data entry for their spreadsheet project. they are in the process of formatting the data to make it easier to read and understand. the title is located in cell a5. the group has decided to merge cells a3: a7 to attempt to center the title over the data. after the merge, allison points out that it is not centered and looks bad. where would the title appear if allison unmerged the cells in an attempt to fix the title problem?
Answers: 2
image
Computers and Technology, 23.06.2019 14:00, shawn423
How are stop motion special effects in animated films created
Answers: 1
image
Computers and Technology, 24.06.2019 18:30, txa95
After making a powerpoint presentation about a new line of clothing designs, henri notices that he used the word “gorgeous” on nearly every slide. what would be the  best  way to add more variety to his wording by using tools within powerpoint? using the thesaurus under the view tab, and then using the find dialog box to find and replace every instance of “gorgeous”using the spelling checker under the view tab, and then using the find dialog box to find every instance of “gorgeous” and change some of themusing the thesaurus under the review tab, and then using the find dialog box to find every instance of “gorgeous” and change some of themusing the spelling checker under the review tab, and then using the find dialog box to find and replace every instance of “gorgeous”
Answers: 2
You know the right answer?
Given a data file, find the max, min, and average values of columns. Also, create an addition column...

Questions in other subjects:

Konu
Computers and Technology, 15.01.2021 07:40