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

Write a program for C++ that will take a depth (in kilometers) inside the earth

ID: 670796 • Letter: W

Question

Write a program for C++ that will take a depth (in kilometers) inside the earth as input data; compute and

display the temperature at this depth in degrees Celsius and degree Fahrenheit. The relevant

formulas are:

celsius = 10*depth + 20 (Celsius temperature at depth in km)

fahrenheit = 1.8*celsius + 32.

You should include four functions in your program.

1.void print_introduction (void)

2.double celsius_at_depth (double depth)

3.double celsius_to_fahrenheit (double celsius)

4.void print_conclusion(double depth)

Explanation / Answer

void celsius_at_depth(void); void fahrenheit(void); int main(void) { depth(); celsius_at_depth(); fahrenheit(); print("Enter depth in kilometers => "); scanf("%lf", &depth); printf("The temperature is %.0f degrees C or %.1F degrees F. ", celsius_at_depth, fahrenheit); return (0); } /* Compute celsius with given depth */ void celsius_at_depth(void) { return (10*depth+20); } /* Convert Celsius to Fahrenheit */ void fahrenheit(void) { return (1.8*celsius_at_depth+32); }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote