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 WeeklyGasAverages.txt The file contains the average gas price for each week in the year There are lines in the file. Line contains the average price for week line contains the average price for week 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 sortedaverages.txtAttached to this assignment is a text file named WeeklyGasAverages.txt The file contains the average
gas price for each week in the year There are lines in the file. Line contains the average price for
week line contains the average price for week 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 sortedaverages.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 attributesfields 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 sortedaverages.txt
Sample Run:
Lowest price: Week: Month: January
Highest price: Week: Month: August
sortedaverages.txt output
January:
March:
February:
April:
May:
June:
October:
July:
November:
December:
September:
August:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
