Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C Programming Code solve these problems Problem 1 7 Suppose you have three lists that contain the height in meter, the corresponding weight in

Using C Programming Code solve these problems
Problem 17
Suppose you have three lists that contain the height in meter, the corresponding weight in kilogram, and the body mass index (bmi) of the
height and weight as follow:
height =[1.47,1.5,1.52,1.55,1.57,1.6,1.63,1.65,1.68,1.7,1.73,1.75,1.78,1.8,1.83]
weight =[52.21,53.12,54.48,55.84,57.2,58.57,59.93,61.29,63.11,64.47,66.28,68.1,69.92,72.19,74.46]
bmi =[24.16,23.61,23.58,23.24,23.21,22.88,22.56,22.51,22.36,22.31,22.15,22.24,22.07,22.28,22.23]
Show the first 6 rows of the data as a pretty (aligned) table so it looks like a table ie
Height Weight Bm1
1.4752.2124.16
Problem 18
Two new people are added to these height (in meters) and weight (in kilogram) lists. They are the numbers in red below. Add those data to the arrays
height =[1.47,1.5,1.52,1.55,1.57,1.6,1.63,1.65,1.68,1.7,1.73,1.75,1.78,1.8,1.83,1.81,2.20]
weight =[52.21,53.12,54.48,55.84,57.2,58.57,59.93,61.29,63.11,64.47,66.28,68.1,69.92,72.19,74.46,49.12,85.65]
Calculate the bmi of the last person added
Calculate the bmi of the second to last person added
Hint: to get the last person's height and weight you can use length-1 trick
Hint: to get the second to last persons height and weight you can uselegth -2 trick
Hint: The formula for BMI is weight in kilograms divided by height in meters squared
Problem 19
You will use the data you created in Problem 17 If you like solving this problem you could consider getting into data science.
Write a function get_sample_mean that takes in two input arguments: the desired sample_size and a dataframe called data. In the function pull a random sample of the specified sample_size of rows and save those as another array. Now Calculate and return the mean of the sample dataframe.
Call your function on the height array with a sample size of 5 and print the mean
Call your function on the weight array with a sample size of 5 and print the mean
Call your function on the bmi column array with a sample size of 5 and print the mean.
Basically for the mean you gotta sum up the sample array and divide it by the length of the sample array
HINT: OK so this is C not python so we cant really use pandas to create real data frames. Instead you can just use simple arrays for your data set. As far as taking a random sample you could copy the array (or not) and just shuffle it using like the fisher yates method i gave you for the horse racing already (i gave you a shuffle method for that and you used it or wrote your own to shuffle the horses) and then pull the number of samples out. So if you had a ten element array you could just copy and shuffle it and then pull out however many items you want for your sample, so if you needed a random sample of 3 items out of a ten element array you could shuffle the array and pull out the first three items from the shuffled array for your sample. There are probably other solutions for this online. I am just giving you the easiest one probably..
Problem 20
Create a Coord struct with an integer x and y in it. Set x to 2 and y to 3
Make a method called wontchaneg pass the coord in it by copy and have the method add a 100 to x and 1000 y.
Print the x and y values in the struct in main (will still be 2 and 3)
Now,
Make a method called willchange pass the coord in it by address and have the method add a 100 to x and 1000 y.
Print the x and y values in the struct in main (will now be be 102 and 1003)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Theory And Application Bio Science And Bio Technology International Conferences DTA And BSBT 2011 Held As Part Of The Future Generation In Computer And Information Science 258

Authors: Tai-hoon Kim ,Hojjat Adeli ,Alfredo Cuzzocrea ,Tughrul Arslan ,Yanchun Zhang ,Jianhua Ma ,Kyo-il Chung ,Siti Mariyam ,Xiaofeng Song

2011th Edition

3642271561, 978-3642271564

More Books

Students also viewed these Databases questions

Question

6 Transfer does not happen by chance. Discuss

Answered: 1 week ago

Question

Why We Form Relationships Managing Relationship Dynamics?

Answered: 1 week ago