Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Sample Runs for Temperature Conversion Programming Assignment This program will convert a temperature reading provided in either Fahrenheit or Celsius to the other measurement scale.
Sample Runs for Temperature Conversion Programming Assignment This program will convert a temperature reading provided in either Fahrenheit or Celsius to the other measurement scale. f E What temperature scale did you use (F = Fahrenheit; C = Celsius)? Please enter your temperature reading (in degrees): 212 Your temperature reading converts as follows: Fahrenheit: 212.00 F Celsius: 100.00 C This program will convert a temperature reading provided in either Fahrenheit or Celsius to the other measurement scale. What temperature scale did you use (F= Fahrenheit; C = Celsius)? Please enter your temperature reading (in degrees): 37 Your temperature reading converts as follows: Fahrenheit: 98.60 F Celsius: 37.00 C This program will convert a temperature reading provided in either Fahrenheit or Celsius to the other measurement scale. What temperature scale did you use (F = Fahrenheit; C = Celsius)? X ***ERROR: invalid temperature scale. This program will convert a temperature reading provided in either Fahrenheit or Celsius to the other measurement scale. What temperature scale did you use (F = Fahrenheit; C = Celsius)? F Please enter your temperature reading (in degrees): -2345.6789 CSC135 Programming Assignment #3 Functions (Temperature Conversion) The vast majority of the world population uses the Celsius scale to measure temperature, but the United States uses the Fahrenheit scale as its primary means to do so. Your task is to create a program that implements functions to convert a temperature from either scale to its corresponding value in the other. Name the program: functions.cpp (plural, no caps) Using F to represent a Fahrenheit temperature and C to represent a Celsius temperature, the following formulas are used to convert between the two temperature scales (either version of each formula may be used, but care must be taken to address potential type casting issues depending on their implementation): F=?C+32 OR F=1.8C+32 5 C = (F32 ) or c=4 F-32 1.8 Your program must prompt the user for the scale and degree measurement of the initial temperature and display both the Fahrenheit and Celsius equivalents of the temperature provided, rounded to two decimal places. If inappropriate input is provided for either the scale or temperature, the program must display an appropriate error message and terminate execution without displaying any results. Appropriate input for the temperature scale will depend on how the information is obtained; appropriate temperatures are any values greater than or equal to absolute zero, which is 459.67F or -273.15C. The main function of the program may only contain variable declarations and function calls. If statements that control program flow by testing function return values are OK. Otherwise, no calculations should be done in main. To process data, as a minimum, your program must make proper use of an appropriate function for each of the following tasks, although you may include as many additional functions as you desire: 1. Display a brief overview and/or set of instructions explaining the program to the user 2. Have the user enter the temperature scale used 3. Have the user enter the initial temperature reading 4. Convert a Fahrenheit temperature to Celsius 5. Convert a Celsius temperature to Fahrenheit 6. Display the results Several sample runs are provided on the next page for testing purposes. You are not required to make your program output look identical to the samples as long as all criteria are met
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started