Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

F to C Write a program to display a table of Fahrenheit temperatures and their equivalent Celsius temperatures. Create a function to do the conversion

F to C

Write a program to display a table of Fahrenheit temperatures and their equivalent Celsius temperatures. Create a function to do the conversion from Fahrenheit to Celsius. Invoke the function from within a for loop in main() to display the table. Ask the user for a starting temperature and and ending temperature. Validate that the starting temperature is within the range of -100 to 300 degrees, Validate that the ending temperature is in the range of -100 to 300 degrees, and is also greater than the starting temperature. Use a decision inside the validation loop to display either the "out-of-range" message or the "greater than starting temperature" message.

The formula for converting a Fahrenheit temperature to Celsius is: C = (5 / 9) * (F - 32) Use this exact formula - do not pre-calculate 5/9 as .56 (you will have to temporarily convert one of the numbers to a double using static_cast for the equation to work correctly).

Format the Celsius temperatures to 1 decimal place.

Example Run #1: (bold type is what is entered by the user)

Enter a starting Fahrenheit temperature: -200 The starting temperature must be between -100 and 300 degrees. Please re-enter the starting temperature: 0 Enter an ending Fahrenheit temperature: 500 The ending temperature must be between -100 and 300 degrees. Please re-enter the ending temperature: -20 The ending temperature must be greater than the starting temperature. Please re-enter the ending temperature: 20

Fahrenheit Celsius 0 xx.x 1 xx.x 2 xx.x 3 xx.x 4 xx.x 5 xx.x 6 xx.x 7 xx.x 8 xx.x 9 xx.x 10 xx.x 11 xx.x 12 xx.x 13 xx.x 14 xx.x 15 xx.x 16 xx.x 17 xx.x 18 xx.x 19 xx.x 20 xx.x

The example run shows EXACTLY how your program input and output will look.

Please write in C, with printf and scanf statement. Include integers, doubles and loops where they are needed. Also function definitions and parameters.

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

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions

Question

IN SD - WAN, What does a centralized control policy affect?

Answered: 1 week ago

Question

How to find if any no. is divisble by 4 or not ?

Answered: 1 week ago

Question

Explain the Pascals Law ?

Answered: 1 week ago

Question

What are the objectives of performance appraisal ?

Answered: 1 week ago