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
icon
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.11C
Expert Solution
Step 1

PROGRAM EXPLANATION:

  1. Include the header file.
  2. Define the main function.
  3. Print the menu to the user about the temperature units.
  4. Ask the user to enter the unit and then take temperature as input.
  5. Ask the user to enter the output unit.
  6. Now using the switch-case convert the input temperature into kelvin.
  7. Again using the switch-case convert the corresponding kelvin into an input unit using the formula given in the question.
  8. Print the output temperature.
  9. End of the program.

 

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education