Question: Program C homework The table below shows the normal boiling points of several substances. Write a function that accepts an argument the observed boiling point

Program C homework

The table below shows the normal boiling points of several substances. Write

a function that accepts an argument the observed boiling point of a substance in degrees Celsius and identifies the substance if the observed boiling point is within 5% of the expected boiling point. If the data input is more than 5% higher or lower than any of the boiling points in the table, the function should output the message Substance unknown. Note that the function should print the substance and not main. This will simplify the function call in main. You need to test each substance in an else if chain for the temperature passed from main.

Substance Normal boiling point (Celsius) Water 100 Mercury 357 Copper 1187 Silver 2193 Gold 2660

Your function should define and call a function within_x_percent that takes as parameters a reference value ref , a data value data , and a percentage value x and returns 1 meaning true if data is within x % of ref -that is, (ref - x% * ref) <= data <= (ref + x % * ref) . Otherwise within_x_percent would return zero, meaning false. For example, the call within_x_percent(357, 323, 10) would return true, since 10% of 357 is 35.7, and 323 falls between 321.3 and 392.7. Sample screen output:

FIND SUBSTANCE FOR BOILING POINT Enter a temperature: 360 The substance is Mercury

*/

// Preprocessor directives

// Function prototypes

// Main function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!