Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Say that you are a weather forecaster, and you wish to give a weather report. You are at an international gathering of weather scientists. The
Say that you are a weather forecaster, and you wish to give a weather report. You are at an international gathering of weather scientists. The problem is, that as an American, most scientists report the weather in Celsius, not Fahrenheit! Create two overloaded functions average_weather_temps. One will take a vector of 7 floats, denoting the average high temperatures over a given week, and return the average. The other is specially created for American weather scientists this special overloaded function will take the vector of floats, along with the character 'F' as a variable. This variable means that the temperatures must be converted into Celsius. The average temperature, in Celsius, is returned. Soto be clear, I am looking for two functions with the same name. One function will take two variables, and the other function will take one. To convert between Celsius and Fahrenheit, subtract 32 and multiply by 5/9. Week 1 Average Week 2 Average #include #include using namespace std; int main( ) { vector f_temps; f_temps . insert (f_temps . end( ) , { 56, 53, 43, 50, 49, 64, 78 }) ; vector c_temps; c_temps . insert (c_temps . end( ) , { 4, 3, -1, -2, 5, 15, 13, 5 }); float average_week_1 = average_weather_temps (f_temps, 'f' ) ; float average_week_2 = average_weather_temps (c_temps ) ; cout
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