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 35\deg C, or 95\deg F Hot if the converted temperature is between (29\deg C to 35\deg C], or (85\deg F to 95\deg F] Mild if the converted temperature is between (18\deg C to 29\deg C], or (65\deg F to 85\deg F] Cool if the converted temperature is between (9\deg C to 18\deg C], or (49\deg F to 65\deg F] Cold if the converted temperature is between (0\deg C to 9\deg C], or (32\deg F to 49\deg F] Freezing if the converted temperature is less than or equal to 0\deg C, or 32\deg FFor example, one run might look as follows:Enter a unit of measurement for the temperature: CEnter a temperature: 20The temperature 20 in Celsius is equivalent to 68 in Fahrenheit The weather is: MildAs 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.

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

50 Tips And Tricks For MongoDB Developers Get The Most Out Of Your Database

Authors: Kristina Chodorow

1st Edition

1449304613, 978-1449304614

More Books

Students also viewed these Databases questions