The goal of this lab is to create a calculator to convert a temperature between different units. Print a menu of temperature units available as either an input or output to the calculator Ask the user for the units of the input temperature Use the unit_input variable to grab a character Ask the user for the desired units of the output temperature Use the unit_output variable to grab a character Ask the user for the input temperature (use prior unit_input character in the print statement) Create a switch/case statement that calculates the Kelvin equivalent of the input temperature Use the Kelvin Variable to hold the result Have a case for each input temperature (remember to use 'single quotes' for characters) Create a switch/case statement that calculates the desired equivalent output temperature Convert from Kelvin to desired units Store the result in the output variable Have a case for each output temperature (remember to use 'single quotes' for characters) -Display the result Some useful formulas: [K] = [C] + 273.15 [K] = 5/9 * ( [F] + 459.67 ) [K] = 5/9 * [R] An example of the program is displayed below: **********TEMPERATURE CONVERSION CALCULATOR********** *******Temperature Units****** C) Celsius K) Kelvin F) Fahrenheit R) Rankine Input Temperature Unit(C, K, F, or R)>F Output Temperature Unit(C, K, F, or R)>C Enter Temperature (deg F)>70 RESULT: 70.00F is equal to 21.11C
The goal of this lab is to create a calculator to convert a temperature between different units. Print a menu of temperature units available as either an input or output to the calculator Ask the user for the units of the input temperature Use the unit_input variable to grab a character Ask the user for the desired units of the output temperature Use the unit_output variable to grab a character Ask the user for the input temperature (use prior unit_input character in the print statement) Create a switch/case statement that calculates the Kelvin equivalent of the input temperature Use the Kelvin Variable to hold the result Have a case for each input temperature (remember to use 'single quotes' for characters) Create a switch/case statement that calculates the desired equivalent output temperature Convert from Kelvin to desired units Store the result in the output variable Have a case for each output temperature (remember to use 'single quotes' for characters) -Display the result Some useful formulas: [K] = [C] + 273.15 [K] = 5/9 * ( [F] + 459.67 ) [K] = 5/9 * [R] An example of the program is displayed below: **********TEMPERATURE CONVERSION CALCULATOR********** *******Temperature Units****** C) Celsius K) Kelvin F) Fahrenheit R) Rankine Input Temperature Unit(C, K, F, or R)>F Output Temperature Unit(C, K, F, or R)>C Enter Temperature (deg F)>70 RESULT: 70.00F is equal to 21.11C
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
c code please 3.30 Lab: Temperature Converter with a Menu
The goal of this lab is to create a calculator to convert a temperature between different units.
- Print a menu of temperature units available as either an input or output to the calculator
- Ask the user for the units of the input temperature
- Use the unit_input variable to grab a character
- Ask the user for the desired units of the output temperature
- Use the unit_output variable to grab a character
- Ask the user for the input temperature (use prior unit_input character in the print statement)
- Create a switch/case statement that calculates the Kelvin equivalent of the input temperature
- Use the Kelvin Variable to hold the result
- Have a case for each input temperature (remember to use 'single quotes' for characters)
- Create a switch/case statement that calculates the desired equivalent output temperature
- Convert from Kelvin to desired units
- Store the result in the output variable
- Have a case for each output temperature (remember to use 'single quotes' for characters) -Display the result
Some useful formulas:
- [K] = [C] + 273.15
- [K] = 5/9 * ( [F] + 459.67 )
- [K] = 5/9 * [R]
An example of the program is displayed below:
**********TEMPERATURE CONVERSION CALCULATOR********** *******Temperature Units****** C) Celsius K) Kelvin F) Fahrenheit R) Rankine Input Temperature Unit(C, K, F, or R)>F Output Temperature Unit(C, K, F, or R)>C Enter Temperature (deg F)>70 RESULT: 70.00F is equal to 21.11CExpert Solution
Step 1
PROGRAM EXPLANATION:
- Include the header file.
- Define the main function.
- Print the menu to the user about the temperature units.
- Ask the user to enter the unit and then take temperature as input.
- Ask the user to enter the output unit.
- Now using the switch-case convert the input temperature into kelvin.
- Again using the switch-case convert the corresponding kelvin into an input unit using the formula given in the question.
- Print the output temperature.
- End of the program.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education