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 Description 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 present for the years 1993 and 2013.) Average Price Per Month: Calculate the average price for each month in the file. Highest and Lowest Prices Per Year: For each year in the file, determine the date and amount for the lowest price, and the highest price. List of Prices, Lowest to Highest: Generate a text file that lists the dates and prices, sorted from the lowest price to the highest. List of Prices, Highest to lowest: Generate a text file that lists the dates and prices, sorted from the highest price to the lowest. You can write one program to perform all of these calculations, or you can write different programs, one for each calculation. For the attached assignment, write a python program, you also need to write: Comments for all the values, constants, and functions IPO Variables Pseudocode

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter14: Files And Streams
Section: Chapter Questions
Problem 1DE
icon
Related questions
Question

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
Description
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
present for the years 1993 and 2013.)
Average Price Per Month: Calculate the average price for each month in the file.
Highest and Lowest Prices Per Year: For each year in the file, determine the date and
amount for the lowest price, and the highest price.
List of Prices, Lowest to Highest: Generate a text file that lists the dates and prices, sorted
from the lowest price to the highest.
List of Prices, Highest to lowest: Generate a text file that lists the dates and prices, sorted
from the highest price to the lowest.
You can write one program to perform all of these calculations, or you can write different
programs, one for each calculation.

For the attached assignment, write a python program,

you also need to write:

    • Comments for all the values, constants, and functions
    • IPO
    • Variables
    • Pseudocode 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,