Answered step by step
Verified Expert Solution
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
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
weight
bmi
Show the first rows of the data as a pretty aligned table so it looks like a table ie
Height Weight Bm
Problem
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
weight
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 trick
Hint: to get the second to last persons height and weight you can uselegth trick
Hint: The formula for BMI is weight in kilograms divided by height in meters squared
Problem
You will use the data you created in Problem If you like solving this problem you could consider getting into data science.
Write a function getsamplemean that takes in two input arguments: the desired samplesize and a dataframe called data. In the function pull a random sample of the specified samplesize 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 and print the mean
Call your function on the weight array with a sample size of and print the mean
Call your function on the bmi column array with a sample size of 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 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
Create a Coord struct with an integer x and y in it Set x to and y to
Make a method called wontchaneg pass the coord in it by copy and have the method add a to x and y
Print the x and y values in the struct in main will still be and
Now,
Make a method called willchange pass the coord in it by address and have the method add a to x and y
Print the x and y values in the struct in main will now be be and
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