Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

My code so far: /* A program that takes depth in KM inside of earth and displays the temperature at this depth in degrees Celsius

image text in transcribed

My code so far:

/* A program that takes depth in KM inside of earth and displays the

temperature at this depth in degrees Celsius and degrees Fahrenheit */

#include

#include

#include

using namespace std;

void print_introduction(void);

double celsius_at_depth(double depth);

double celsius_to_fahrenheit (double celsius);

void print_conclusion(double depth);

int main()

{

double depth;

char answer;

do {

print_introduction();

cout

cin >> depth;

print_conclusion();

} while (answer == 'y' || answer == 'Y');

system("pause");

return 0;

}

void print_introduction()

{

cout

}

double celsius_at_depth(double depth)

{

return celsius_at_depth(10 * depth + 20);

}

double celsius_to_fahrenheit(double celsius)

{

return celsius_to_fahrenheit(1.8*celsius + 32);

}

void print_conclusion(double depth)

{

cout

}

__________________________________________________________________________________________________________________

When I compile it says "too few arguments in function call Line 26, and print_conclusion function does not take 0 arguments.

I'm new at this please help! I'm a little confused with how functions work and the order. If someone can show me how this is done, and give me tips that would be great.

Thank you.

Purpose: The project is designed to ensure that the students know how to the write and call functions Before start: Review chapter 4. Make sure that you understand the following things How to declare a function How to write a function How to call a function, including call function A from function B which is not main function Problem Write a program to 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) // prints out information to tell the user what this program does. 2. double celsius_at depth (double depth) // computes and returns the celsius temperature at a depth measured in kilometers 3. double celsius_to fahrenheit (double celsius) // converts a Celsius temperature celsius to Fahrenheit. 4. void print_conclusion(double depth) // display the conclusion that what is the temperature in Fahrenheit at depth of the earth Requirement: There is no calculation in main function except function calls to two void functions. The pseudo code for main function is follows Step 1: print introduction by calling print_introduction function Step 2: ask user to enter the depth Step 3: get user's input Step 4: print out the conclusion by calling print_conclusion function Step 5: ask user if he/she wants to continue Step 6: get user's input Step 7: repeat step 1 to step 6 if user picks or y Step 8: Stop program All the necessary calculations are done in print_conclusion function. i.e. celsius_at depth and celsius to fahrenheit functions are called from printconclusion function. There is no explicit calculation in main function. No calling to two calculation functions in main function. Run the demo the see the sample output

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

Step: 3

blur-text-image

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

The Database Experts Guide To SQL

Authors: Frank Lusardi

1st Edition

0070390029, 978-0070390027

More Books

Students also viewed these Databases questions

Question

3. Would you say that effective teamwork saved their lives?

Answered: 1 week ago