Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 5 (35 marks) You are working as a lab assistant, and have been asked to automate certain procedures for experimental measurements. These experiments are

image text in transcribed

Question 5 (35 marks) You are working as a lab assistant, and have been asked to automate certain procedures for experimental measurements. These experiments are varied, but all rely on multiple measurements being made Write a C function (not a whole proaram) called autoMeasure to do the following 1. Take successive measurements. To do this, your function will take (as a parameter, among other parameters) a pointer to a function-the "measurement function". The measurement function will operate hardware that measures "gamma" and "delta"two properties under analysis. (We don't need to know what these really are.) take two pointers to doubles, in order to export the measurements return void 2. Sanity-check the measurements using the following pre-defined function int isSane (double gamma, double delta); This returns the pre-defined constant SANE if the values are to be considered valid, or something else if the values should be discarded (Do not define isSane() or the SANE constant yourselfthese have already been defined for you.) 3. Calculate and export averages of the valid gamma and delta measurements 4. Stop after a pre-defined number of valid measurements (pairs of gamma and delta values), or if three invalid measurements in a row are taken 5. Count the number of valid measurements actually made Your function should return void, and take these parameters max-an int, the maximum number of measurements to take gAvg-a pointer to a double, the average gamma measurement; dAvg-a pointer to a double, the average delta measurement; count- a pointer to an int, the number of valid measurements made; measurea pointer to the measurement function, as described above Question 5 (35 marks) You are working as a lab assistant, and have been asked to automate certain procedures for experimental measurements. These experiments are varied, but all rely on multiple measurements being made Write a C function (not a whole proaram) called autoMeasure to do the following 1. Take successive measurements. To do this, your function will take (as a parameter, among other parameters) a pointer to a function-the "measurement function". The measurement function will operate hardware that measures "gamma" and "delta"two properties under analysis. (We don't need to know what these really are.) take two pointers to doubles, in order to export the measurements return void 2. Sanity-check the measurements using the following pre-defined function int isSane (double gamma, double delta); This returns the pre-defined constant SANE if the values are to be considered valid, or something else if the values should be discarded (Do not define isSane() or the SANE constant yourselfthese have already been defined for you.) 3. Calculate and export averages of the valid gamma and delta measurements 4. Stop after a pre-defined number of valid measurements (pairs of gamma and delta values), or if three invalid measurements in a row are taken 5. Count the number of valid measurements actually made Your function should return void, and take these parameters max-an int, the maximum number of measurements to take gAvg-a pointer to a double, the average gamma measurement; dAvg-a pointer to a double, the average delta measurement; count- a pointer to an int, the number of valid measurements made; measurea pointer to the measurement function, as described above

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_2

Step: 3

blur-text-image_3

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

Students also viewed these Databases questions

Question

=+j Describe the various support services delivered by IHR.

Answered: 1 week ago

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago