Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program that first asks the user which Temperature scale conversion he/she would like to perform: 1. Convert F to C 2. Convert

Write a C++ program that first asks the user which Temperature scale conversion he/she would like to perform: 1. Convert F to C 2. Convert C to F 3. Quit What is your choice?

Then it asks the user for input for three real number variables: starttemp, endtemp, temp_incr. It will then produce a two column Fahrenheit to Celsius table or a two column Celsius to Fahrenheit table, depending on the choice.

Choice 1: the first column should be labeled Fahrenheit and the first value the Fahrenheit column is start_temp. The second column should be labeled Celsius, and its value is calculated from the values in the Fahrenheit column using the formula C = (5.0/9.0)*(F 32.0).

Fahrenheit Celsius 29.00 -1.67 

Choice 2: the table will show the Celsius column first, Fahrenheit column second, and use the formula F = 9.0/5.0 * C + 32.0 to calculate the temperature in Fahrenheit.

Celsius Fahrenheit 35.00 95.00 

The values for the temps in the first column will be incremented by temp_incr, and end when the table value would exceed the end_temp value. Display all values with 2 decimal of accuracy, justified and aligned.

Requirements:

A detailed algorithm

Verify all numeric data are acceptable and not character

Follow all good programming practices such as descriptive variable names, constants names, proper indentation,

Verify input for correct range and type ( not character)

Output must be the same as the sample shown below.

Sample Output

Sample 1:

Choose a conversion type: 1. Convert F to C 2. Convert C to F 3. Quit What is your choice? 1 Enter starting value: 29 Enter ending value: 32 Enter increment value: 0.5 Fahrenheit Celsius 29.00 -1.67 29.50 -1.39 30.00 -1.11 30.50 -0.83 31.00 -0.56 31.50 -0.28 32.00 0.00 

Sample 2:

Choose a conversion type: 1. Convert F to C 2. Convert C to F 3. Quit What is your choice? 4 Invalid choice. Try again. 

Sample 3:

Choose a conversion type: 1. Convert F to C 2. Convert C to F 3. Quit What is your choice? 2 Enter starting value: 35 Enter ending value: 32 Enter increment value: -1 Celsius Fahrenheit 35.00 95.00 34.00 93.20 33.00 91.40 32.00 89.60 

Sample 4:

Choose a conversion type: 1. Convert F to C 2. Convert C to F 3. Quit What is your choice? 3 Thank you for using my program. Program terminated. 

Sample 5:

Choose a conversion type: 1. Convert F to C 2. Convert C to F 3. Quit What is your choice? x Invalid data type, must be a number. Program terminated.

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

More Books

Students also viewed these Databases questions