Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(conversion between celsuis and fahrenheit, write a header file that contains th

ID: 3632858 • Letter: #

Question

(conversion between celsuis and fahrenheit, write a header file that contains the folowing two fonctions.
/* Convert from celsuis to fahrenheit */
double celsiusToFahrenheit(double celsius)

/* Convert from fahrenheit to celsius */
double fahrenheitToCelsius(double fahrenheit)

the formula for the comversion is:
fahrenheit = (9.0 / 5) * celsius +32

Implement the header file and write a test program that invokes thes fonctions to display the following table

Celsius, Fahrenheit | Fahrenheit Celsius
40.0 104.0 | 120.0 48.8
39.0 102.0 | 110.0 43.33
..... |
32.0 89.6 | 40.0 4.44
31.0 87.8 | 30.0 -1.11

Explanation / Answer

#ifndef CONVERSIONS_H

double celsiusToFahrenheit(double celsius)

/* (no constant or type definitions) */

/* FUNCTION TO CONVERT FAHRENHEIT TO CELSIUS */

double fahrenheitToCelsius(double fahr);

/* FUNCTION TO CONVERT FAHRENHEIT TO ABSOLUTE VALUE */

double absolute_value_of(int fahr);

#define CONVERSIONS_H

#endif

#include"conversions.h"

using namespace std;

/* FUNCTION TO CONVERT FAHRENHEIT TO CELSIUS */

double fahrenheitToCelsius(double fahr);

{

return (static_cast<double>(5)/9) * (fahr - 32);

}

/* FUNCTION TO CONVERT CELSIUS to FAHRENHEIT */

double celsiusToFahrenheit(double celsius)

{

return (static_cast<double>(9.0/5)*celsius+32);

}