Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using only the techniques and methods taught in CS 1 1 0 , write a C + + program that acts as a temperature converter
Using only the techniques and methods taught in CS write a C program that acts as a temperature converter and weather classifier. The program must prompt the user to choose a unit of measurement for the temperature by typing in the letter corresponding to the desired unit: c or C for Celsius and f or F for Fahrenheit. If the user types a different letter, the program should display an error message and exits. After selecting the desired unit, the program should prompt the user to enter a temperature in the selected unit, and convert it to the opposite unit: if the user selects c or C then the program must convert the entered temperature to Fahrenheit, and if the user selects f or F then the program must convert the entered temperature to Celsius. After converting the temperature, the program must classify it according to the following six categories, and display the appropriate class label: Humid if the converted temperature is greater than deg C or deg F Hot if the converted temperature is between deg C to deg C or deg F to deg F Mild if the converted temperature is between deg C to deg C or deg F to deg F Cool if the converted temperature is between deg C to deg C or deg F to deg F Cold if the converted temperature is between deg C to deg C or deg F to deg F Freezing if the converted temperature is less than or equal to deg C or deg FFor example, one run might look as follows:Enter a unit of measurement for the temperature: CEnter a temperature: The temperature in Celsius is equivalent to in Fahrenheit The weather is: MildAs part of your answer, include a subfunction, called FahrenheitToCelcius, that takes one pa rameter and converts a temperature to Celcius. Include another subfunction, called CelciusTo Fahrenheit, that takes one parameter and converts a temperature to Fahrenheit. Include another subfunction, called WeatherClassifier that takes two parameters and classifies the converted tem perature according to the abovementioned ranges, and prints out the appropriate class label.
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