Question: Write a C++ program to convert Celsius to Fahrenheit or Fahrenheit to Celsius depending on the users choice. ( You must use multiple functi ons

Write a C++ program to convert Celsius to Fahrenheit or Fahrenheit to Celsius depending on the users choice. (You must use multiple functions in your source code to receive a grade for this assignment.)

a. Use main( ) as the driver function. main( ) should allow the user to run the program as many times as desired.

b. Write the function getConvertChoice( ) to prompt the user for the desired conversion:

1. Celsius to Fahrenheit

2. Fahrenheit to Celsius.

Return this value back to main( ).

c. Write the function getTemperature( ) to prompt the user for the temperature in degrees to be converted.

d. Depending on the users conversion choice: 1) call the function convertToFahren( ), if the user chose to convert from Celsius to Fahrenheit, or 2) call the function convertToCelsius( ) if the user chose to convert from Fahrenheit to Celsius. The formulas are: Fahrenheit = (9.0/5.0) * Celsius + 32.0

Celsius = (5.0/9.0) * (Fahrenheit 32.0)

e. Write the function displayConversion( ) to display the original temperature entered and the converted temperature with appropriate messages. Display the values to a tenth of a decimal.

Sample I/O:

Please choose the desired conversion from the menu.

1. Convert from Celsius to Fahrenheit.

2. Convert from Fahrenheit to Celsius.

Enter choice: ? 1

Please enter the temperature to be converted: ? 0

The temperature entered in Celsius is: 0.0

The temperature converted to Fahrenheit is: 32.0

Would you like to convert another temperature? Y or N y

Please choose the desired conversion from the menu.

1. Convert from Celsius to Fahrenheit.

2. Convert from Fahrenheit to Celsius.

Enter choice: ? 2

Please enter the temperature to be converted: ? 98.6

The temperature entered in Fahrenheit is: 98.6

The temperature converted to Celsius is: 37.0

Would you like to convert another temperature? Y or N n

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!