Answered step by step
Verified Expert Solution
Link Copied!

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 CS110, 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 35C, or 95F
"Hot" if the converted temperature is between to 35C, or to 95F]
"Mild" if the converted temperature is between to {:29C], or to 85F]
"Cool" if the converted temperature is between to 18C, or to 65F]
"Cold" if the converted temperature is between to 9C, or to 49F]
"Freezing" if the converted temperature is less than or equal to 0C, or 32F
For example, one run might look as follows:
Enter a unit of measurement for the temperature: C
Enter a temperature: 20
The temperature 20 in Celsius is equivalent to 68 in Fahrenheit
The weather is: Mild
As part of your answer, include a sub-function, called FahrenheitToCelcius, that takes one pa-
rameter and converts a temperature to Celcius. Include another sub-function, called CelciusTo-
Fahrenheit, that takes one parameter and converts a temperature to Fahrenheit. Include another
sub-function, called WeatherClassifier that takes two parameters and classifies the converted tem-
perature according to the above-mentioned ranges, and prints out the appropriate class label.
For converting Celsius to Fahrenheit:
F=(9.0**C5)+32
For converting Fahrenheit to Celsius:
C=5.0**F-329
Question: (1 Mark)
What type of functions are FahrenheitToCelsius, CelciusToFahrenheit, and WeatherClassifier? Ex-
plain your answer.
image text in transcribed

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_2

Step: 3

blur-text-image_3

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

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions

Question

Can you please help me answer questions a through d?

Answered: 1 week ago