Question
Here are the numbers: 0.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
Here are the numbers:
0.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
These are the numbers in the txt file. These are average costs per week. 52 averages for the entire year of 1994.
In the student sample programs for this book, you will find a text file named 1994_Weekly_Gas_Averages.txt. The file contains the average gas price for each week in the year 1994. (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 that reads the gas prices from the file into an array or an ArrayList. 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.
Display the average gas price for each month. (To get the average price for a given month, calculate the average of the average weekly prices for that month.)
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