Question: (11 points) Convert temperature: Write, compile, and test a C++ program that uses a switch structure where the user is prompted to enter a temperature

(11 points) Convert temperature: Write, compile, and test a C++ program that uses a switch structure where the user is prompted to enter a temperature and a unit (c, C, f, or F). If the temperature is entered in degrees Fahrenheit it should be converted to degrees Celsius. If the temperature is entered in degrees Celsius it should be converted to Fahrenheit. Hint: Read the temperature as a double and the unit as a char.

Example: Input: 35.2 c Output: 35.2 degrees C = 95.4 degrees F

Use the format specified earlier (initial block of comments with TCC logo, name, description, etc.)

Give clear instructions so that the user knows what to enter.

The output should display the result in both degrees C and degrees F as real numbers.

The program should print an error message if an invalid unit is entered.

Test the program for the 7 inputs shown below.

0 c

100 C

35.2 c

32 f

212 F

95.4 F

Any number followed by an invalid letter

Turn in a printout of the program and printouts of the 7 test cases.

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!