Question
Read the data from a file called temps.txt. 2. Write temperature table to the screen. 3. Write summary data to a file. 4. Minimally, a
Read the data from a file called temps.txt.
2. Write temperature table to the screen.
3. Write summary data to a file.
4. Minimally, a data file must consist of one line containing the number zero indicating that there is no temperature data provided.
5. There is no input from the keyboard in this program. All the data will be read from the input file.
6. Verify that your program works with a wide variety of different temps.txt files, but when you submit your assignment, make certain that the input file is returned to its original state in the example given below. 2
7. All columns in the temperature table are 8 characters wide.
8. Temperatures read in from the file will be integers, but the averages must be displayed as doubles.
9. If the average temperatures are the same, then your program must output (Same).
For example, assume you are given the following input file named temps.txt:
8
43 67
51 76
44 60
43 88
50 86
51 61
66 77
51 76
Your program must produce the following output exactly to the screen:
********************* * Temperature Table * *********************
Day Low High Average Trend
-----------------------------------------
1 43 67 55.00
2 51 76 63.5 warmer
3 44 60 52.0 Cooler
4 43 88 65.5 Warmer
5 50 86 68.0 Warmer
6 51 61 56.0 Cooler
7 66 77 71.5 Warmer
8 51 76 63.5 Cooler
-----------------------------------------
Your program must also produce the following output exactly to a file named summary.txt:
Number of days: 8
Averages
Low Temperature | High Temperature
49.9 | 73.9
Lowest Temperature: 43
Highest Temperature: 88
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