Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

14. Gas Prices In the student sample program files for this chapter, you will find a text file named GasPrices.txt. The file contains the weekly

image text in transcribedimage text in transcribed

14. Gas Prices In the student sample program files for this chapter, you will find a text file named GasPrices.txt. The file contains the weekly average prices for a gallon of gas in the United States, beginning on April 5th, 1993, and ending on August 26th, 2013. Figure 8-7 shows an example of the first few lines of the file's contents: Figure 8-7 The GasPrices.txt file GasPrices.bt Notepad File Edit Format View Help 4-05-1993:1.068 04-12-1993:1.079 04-19-1993:1.079 04-26-1993:1.086 05-03-1993:1.086 05-10-1993:1.097 05-17-1993:1.106 Ln 1, Col Each line in the file contains the average price for a gallon of gas on a specific date. Each line is formatted in the following way: MM-DD-YYYY:Price MM is the two-digit month, DD is the two-digit day, and YYYY is the four-digit year. Price is the average price per gallon of gas on the specified date. For this assignment, you are to write one or more programs that read the contents of the file and perform the following calculations: Average Price Per Year: Calculate the average price of gas per year, for each year in the file (The file's data starts in April of 1993, and it ends in August 2013. Use the data that is pres ent for the years 1993 and 2013.) Based on the given solution to above problem: 14. Gas Prices In the student sample program files for this chapter, you will find a text file named GasPrices.txt. The file contains the weekly average prices for a gallon of gas in the United States, beginning on April 5th, 1993, and ending on August 26th, 2013. Figure 8-7 shows an example of the first few lines of the file's contents: Figure 8-7 The GasPrices.txt file GasPrices.bt Notepad File Edit Format View Help 4-05-1993:1.068 04-12-1993:1.079 04-19-1993:1.079 04-26-1993:1.086 05-03-1993:1.086 05-10-1993:1.097 05-17-1993:1.106 Ln 1, Col Each line in the file contains the average price for a gallon of gas on a specific date. Each line is formatted in the following way: MM-DD-YYYY:Price MM is the two-digit month, DD is the two-digit day, and YYYY is the four-digit year. Price is the average price per gallon of gas on the specified date. For this assignment, you are to write one or more programs that read the contents of the file and perform the following calculations: Average Price Per Year: Calculate the average price of gas per year, for each year in the file (The file's data starts in April of 1993, and it ends in August 2013. Use the data that is pres ent for the years 1993 and 2013.) Based on the given solution to above

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Sham Navathe

4th Edition

0321122267, 978-0321122261

More Books

Students also viewed these Databases questions

Question

Repeat Prob. 19.11 using the software you developed in Prob. 19.12.

Answered: 1 week ago

Question

Discuss the goals of financial management.

Answered: 1 week ago

Question

3. Define the attributions we use to explain behavior

Answered: 1 week ago