Write C++ code that reads the weather temperature forecast for a week. Users are free to enter temperatures in either Fahrenheit or Celsius. The program will then calculate the average temperature for the entire week and display the results in both Fahrenheit and Celsius. Furthermore, the program will provide descriptive information about the forecast, indicating whether the average temperature is freezing, cold, cool, warm, hot, or boiling. Here are the specific program details: • The program should begin by prompting the user to select the temperature unit, either Fahrenheit or Celsius (use switch). • Subsequently, the program should request the user to input 7 temperature readings, which will be stored in an array. • The program's next step is to calculate the average temperature forecast. • The program will then display the calculated average temperature in both Fahrenheit and Celsius degrees to the user. • The average is then printed back to the user in both Fahrenheit and Celsius degrees. • Following that, the program will provide a description of the weekly weather based on the following criteria: 0 °C or below Freezing Below 15 °C Cold Below 25 °C Cool Below 30 °C Warm Below 40 °C Hot Below 100 °C Too hot to live in 100 °C or above Boiling • To enhance user engagement, conclude with an interesting message of your choice that describes the temperature forecast. You are required to make your code readable and self-documented; • Multiple-line comments that: o Identify the owners (who wrote it) and their IDs. o Explain the purpose of the program and the input and output of the code. • Single-line comments that explain complicated or confusing statements and justify your reasoning. (at least 3) • White spaces such as indentation, spaces, and blanks. • Self-documenting variable names. Evaluation (10%): • Test your program with the sample data in the below screenshots (just for you to make sure you get correct results) • Take screenshots of 2 other sample runs that provide different outputs every time. Please pick the temperature unit, type 'c' for Celsius or 'f' for Fahrenheit: c Enter the 7 temperature readings: Day 1: 4 Day 2: 5 Day 3: 2 Day 4: 9 Day 5: 10 Day 6: 9 Day 7: 7 The temperature in Celsius is 6.57143 The temperature in Fahrenheit is 43.8286 The weather is cold, a coat will be enough. Please pick the temperature unit, type 'c' for Celsius or 'f' for Fahrenheit: f Enter the 7 temperature readings: Day 1: 32 Day 2: 56 Day 3: 70 Day 4: 67 Day 5: 75 Day 6: 45 Day 7: 34 The temperature in Celsius is 12.3016 The temperature in Fahrenheit is 54.1429 The weather is cold, a coat will be enough!
Write C++ code that reads the weather temperature forecast for a week. Users are free to enter temperatures in either Fahrenheit or Celsius. The program will then calculate the average temperature for the entire week and display the results in both Fahrenheit and Celsius. Furthermore, the program will provide descriptive information about the forecast, indicating whether the average temperature is freezing, cold, cool, warm, hot, or boiling. Here are the specific program details:
• The program should begin by prompting the user to select the temperature unit, either Fahrenheit or Celsius (use switch).
• Subsequently, the program should request the user to input 7 temperature readings, which will be stored in an array.
• The program's next step is to calculate the average temperature forecast.
• The program will then display the calculated average temperature in both Fahrenheit and Celsius degrees to the user.
• The average is then printed back to the user in both Fahrenheit and Celsius degrees.
• Following that, the program will provide a description of the weekly weather based on the following criteria:
0 °C or below Freezing
Below 15 °C Cold
Below 25 °C Cool
Below 30 °C Warm
Below 40 °C Hot
Below 100 °C Too hot to live in
100 °C or above Boiling
• To enhance user engagement, conclude with an interesting message of your choice that describes the temperature forecast.
You are required to make your code readable and self-documented;
• Multiple-line comments that:
o Identify the owners (who wrote it) and their IDs.
o Explain the purpose of the program and the input and output of the code.
• Single-line comments that explain complicated or confusing statements and justify your reasoning. (at least 3)
• White spaces such as indentation, spaces, and blanks.
• Self-documenting variable names. Evaluation (10%):
• Test your program with the sample data in the below screenshots (just for you to make sure you get correct results)
• Take screenshots of 2 other sample runs that provide different outputs every time.
Please pick the temperature unit, type 'c' for Celsius or
'f' for Fahrenheit: c
Enter the 7 temperature readings:
Day 1: 4
Day 2: 5
Day 3: 2
Day 4: 9
Day 5: 10
Day 6: 9
Day 7: 7
The temperature in Celsius is 6.57143
The temperature in Fahrenheit is 43.8286
The weather is cold, a coat will be enough.
Please pick the temperature unit, type 'c' for Celsius or
'f' for Fahrenheit: f
Enter the 7 temperature readings:
Day 1: 32
Day 2: 56
Day 3: 70
Day 4: 67
Day 5: 75
Day 6: 45
Day 7: 34
The temperature in Celsius is 12.3016
The temperature in Fahrenheit is 54.1429
The weather is cold, a coat will be enough!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images