CS 1428 Programming Assignment #5 Compute Summer Temperature Statistics solved

$25.00

Original Work ?

Download Details:

  • Name: PA5.zip
  • Type: zip
  • Size: 68.82 KB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (1 vote)
Problem:
You will write a program to compute some statistics based on daily high temperatures
recorded throughout the three summer months (June, July, and August). The 2015
data for San Marcos has been downloaded from wunderground.com, and placed in a file
named “tempdata.txt”.
This file has the following format: the first line describes the file contents. The
remaining lines each contain a date followed by the high temperature for that day:
6/1/15 87
The high temperatures are in order, so that the first one is for June 1, the second is for
June 2, and so on through July and August. To keep things simple, I have deleted the
rows for 7/31 and 8/31, so we can assume each month has exactly 30 days.
The statistics you should compute in your program are:
• The average daily high temperature for the entire summer
• The number of days that reached at least 100 degrees for the entire summer
• The maximum temperature for each month and on what day it occurred.
Input:
All of the input will come from the file “tempdata.txt”. You may assume that there will
be 90 dates and temperatures in the file, and that they will be in order from June 1 to
Aug 30 (excluding July 31). I will place a sample file for you to use for testing on the
web page.
Processing: Compute the statistics requested above.
Output: Display the statistics, labelled, and with the average temperature formatted to
1 decimal place.
Sample output is shown on the next page.
High temperature statistics for the summer:
Average daily high temperature: 93.3
Number of days that reached 100 degrees: 7
Maximum temperature for June: 93 occurred on June 9
Maximum temperature for July: 98 occurred on July 23
Maximum temperature for August: 104 occurred on August 12
Additional Requirements:
• I recommend using three arrays to store the temperatures, one for June, one for
July, and one for August.
• Your program should test for file open errors.
• I recommend temporarily echoing the input from the file to the screen (using cout)
to be sure you are reading the input correctly into your array(s).
• Don’t forget to skip the first line in the file.
• There will probably be many loops in your program.
• Grading Threshold: Your program must compile and run, and pass the
following test case. Otherwise you will receive a score of 50 or less, and will receive
no credit for the other grading categories (correctness/constraints/style):
➡ Your program must input the data from the file tempdata.txt posted on the class
website, and output the correct average daily high temperature (93.3).
It must store the temperatures in one or more arrays and compute the sum/
average by iterating over the arrays.
Style:
See the Style Guidelines document on the course website. The grader will deduct
points if your program violates the style guidelines. Make sure it is indented neatly.
Logistics:
Name your file assign5_xxxxx.cpp where xxxxx is your TX State NetID (your
txstate.edu email id). The file name should look something like this: assign5_js236.cpp
There are two steps to the turn-in process:
1. Submit an electronic copy using the Assignments tool on the TRACS website for
this class (tracs.txstate.edu). Submit the .cpp file, (NOT a .cbp file!).
2. Submit a printout of the source file at the beginning of class on the day the
assignment is due. Please print your name on the front page, and staple if there
is more than one page.
See the assignment turn-in policy on the course website (cs.txstate.edu/~js236/cs1428)
for more details.