Answered step by step
Verified Expert Solution
Question
1 Approved Answer
General Description and Specifications: A thermometer at a weather station normally takes one temperature every hour and records it to a text file. Sometimes the
General Description and Specifications: A thermometer at a weather station normally takes one temperature every hour and records it to a text file. Sometimes the thermometer fails to take a reading and/or record it, so some days have fewer than 24 readings The input data file called "tempsin.txt" is organized as follows For each day, there is one line of data. The number of lines (days) may be 0 or more. The number of days is not recorded in the file. Instead, the last line of the file has ENDOFDATA for the date and 0 for the number of readings for the da Each line of the file has data for one day, with data elements separated by spaces, in the order: date (a string with NO spaces). Ex: 01/28/2019 - a number of readings, 0 to 24 - the individual readings between -999 and 999 degrees Fahrenheit Write a program that reads data from the input file and writes a report to a file called "tempsout.txt" in the following format Line 1-a header line with Date", "High" and "Low" spaced as shown below Line 2 - dashed lines: 10, a space, 4, a space and 4 Lines 3- n: - in the first column, the date (left justified, field width 10) - in the second, the highest temperature read for the day (right justified, field width 4) - in the third, the largest temperature read for the day (right justified, field width 4) -a space between the columns Sample Input File 01/24/2019 5 22 27 31 26 19 01/25/2019 8 20 25 30 35 40 38 32 29 01/26/2019 3 0 8 2 ENDOFDATA 0 Sample Output File: based on the data in the sample input file HIGH LOW DATE 01/24/2019 31 19 01/25/201940 20 01/26/2019 No data line for ENDOFDATA
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