The table below shows the normal boiling points of several substances. Write a program that prompts the user for the observed boiling point of a substance in °C and identifies the substance if the observed boiling point is within 5% of the expected boiling point. If the data input is more than5% higher or lower than any of the boiling points in the table, the program should output the message substance unknown.
Substance Normal boiling point (°C)
Water 100
Mercury 357
Copper 1187
Silver 2193
Gold 2660
Your program 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 id 35.7, and 323 falls between 321.3 and 392.7.
Follow these instructions:
• Create a text file (by any tool) name it (comp142.txt) that contains the second column of the above table.
• Let the program read from the created file the values of the variables in the first column of the above table.
• Write the function within_x_percent described above.
• Test your program using the following data
1187 1100 10
1187 1100 5