Question: Attached to this assignment is a text file named Weekly _ Gas _ Averages.txt . The file contains the average gas price for each week

Attached to this assignment is a text file named Weekly_Gas_Averages.txt. The file contains the average gas price for each week in the year 1995.(There are 52 lines in the file. Line 1 contains the average price for week 1, line 2 contains the average price for week 2, and so forth). Write a program to read the gas prices from the file into an ArrayList object. The program should do the following:
Display the lowest average price of the year, along with the week number for that price, and the name of the month in which it occurred.
Display the highest average price of the year, along with the week number for that price, and the name of the month in which it occurred.
Calculate the average gas price for each month. To get the average price for a gien month, calculate the average of the average weekly prices for that month.
Sort the array in Descending order
Write the array to a file named sorted_averages.txtAttached to this assignment is a text file named Weekly_Gas_Averages.txt. The file contains the average
gas price for each week in the year 1995.(There are 52 lines in the file. Line 1 contains the average price for
week 1, line 2 contains the average price for week 2, and so forth). Write a program to read the gas prices
from the file into an ArrayList object. The program should do the following:
Display the lowest average price of the year, along with the week number for that price, and the name
of the month in which it occurred.
Display the highest average price of the year, along with the week number for that price, and the name
of the month in which it occurred.
Calculate the average gas price for each month. To get the average price for a gien month, calculate
the average of the average weekly prices for that month.
Sort the array in Descending order
Write the array to a file named sorted_averages.txt
For Full Credit
You must have a comment block header at the top of each class. See the Standards document in
Course Content
Your program MUST compile successfully or no credit will be given.
You should have a class for the GasWeek, Average and a driver class to test the program
Your class should follow the attached UML diagrams (all attributes/fields and methods need to
match)
You must use the correct data types for your variables
Your output should be formatted correctly
The final sorted list should be saved to a file named sorted_averages.txt
Sample Run:
Lowest price: 0.992 Week: 1 Month: January
Highest price: 1.165 Week: 34 Month: August
sorted_averages.txt output
January: 0.998
March: 1.008
February: 1.010
April: 1.035
May: 1.051
June: 1.082
October: 1.112
July: 1.114
November: 1.117
December: 1.130
September: 1.140
August: 1.1620.992
0.995
1.001
0.999
1.005
1.007
1.016
1.009
1.004
1.007
1.005
1.007
1.012
1.011
1.028
1.033
1.037
1.04
1.045
1.046
1.05
1.056
1.065
1.073
1.079
1.095
1.097
1.103
1.109
1.114
1.13
1.157
1.161
1.165
1.161
1.156
1.15
1.14
1.129
1.12
1.114
1.106
1.107
1.121
1.123
1.122
1.113
1.117
1.127
1.131
1.134
1.125
 Attached to this assignment is a text file named Weekly_Gas_Averages.txt. The

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!