Write a C++ program that will input temperatures for consecutive days. The program will store these values into an array and call a function that will return the average of the temperatures. It will also call a function that will return the highest temperature and a function that will return the lowest temperature. The user will input the number of temperatures to be read. There will be no more than 25 temperatures. For Full Credit You must have a comment block header at the top of your program.  See the Standards document in Course Content You must use a constant to represent the maximum number of temperature readings You must use the correct data types for your constants and variables You must use an array of the correct data type You must validate your input.   Check for number of invalid number of readings (> max, < 1, etc) and display appropriate error message. You must use one or more if/else branches for your decisions You must use a loop to read in the temperatures You must use 3 functions to calculate the average, highest and lowest temperatures Your output should be formatted correctly Temperatures should have two decimal places Sample Run #1: Please input the number of temperatures to be read: 5 Input temperature 1 68 Input temperature 2 75 Input temperature 3 36 Input temperature 4 91 Input temperature 5 84 The average temperature is 70.80 The highest temperature is 91.00 The lowest temperature is 36.00 Sample Run #2: Please input the number of temperatures to be read: 0 No temperatures entered. Sample Run #3: Please input the number of temperatures to be read: 50 Maximum number of readings is 25.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a C++ program that will input temperatures for consecutive days. The program will store these values into an array and call a function that will return the average of the temperatures. It will also call a function that will return the highest temperature and a function that will return the lowest temperature. The user will input the number of temperatures to be read. There will be no more than 25 temperatures.

For Full Credit

  • You must have a comment block header at the top of your program.  See the Standards document in Course Content
  • You must use a constant to represent the maximum number of temperature readings
  • You must use the correct data types for your constants and variables
  • You must use an array of the correct data type
  • You must validate your input.  
    • Check for number of invalid number of readings (> max, < 1, etc) and display appropriate error message.
  • You must use one or more if/else branches for your decisions
  • You must use a loop to read in the temperatures
  • You must use 3 functions to calculate the average, highest and lowest temperatures
  • Your output should be formatted correctly
    • Temperatures should have two decimal places

Sample Run #1:

Please input the number of temperatures to be read:
5
Input temperature 1
68
Input temperature 2
75
Input temperature 3
36
Input temperature 4
91
Input temperature 5
84

The average temperature is 70.80
The highest temperature is 91.00
The lowest temperature is 36.00

Sample Run #2:

Please input the number of temperatures to be read:
0
No temperatures entered.

Sample Run #3:

Please input the number of temperatures to be read:
50
Maximum number of readings is 25.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education