18. Gas Prices In the student sample program files for this chapter, you will find a text file named Gas Prices.txt. The file contains the weekly average prices for a gallon of gas in the United States, beginning on April 5, 1993, and ending on August 26, 2013. Here is an example of the first few lines of the file's contents: 04-05-1993:1.068 04-12-1993:1.079 04-19-1993:1.079 04-26-1993:1.086 05-03-1993:1.086 and so on... Each line in the file contains the average price for a gallon of gas on a specific date. Each line formatted in the following way: MM-DD-YYYY:Price

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
18. Gas Prices
In the student sample program files for this chapter, you will find a text file named
Gas Prices.txt. The file contains the weekly average prices for a gallon of gas in the United
States, beginning
on April 5, 1993, and ending on August 26, 2013. Here is an example of
the first few lines of the file's contents:
04-05-1993:1.068
04-12-1993:1.079
04-19-1993:1.079
04-26-1993:1.086
05-03-1993:1.086
and so on...
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
Transcribed Image Text:18. Gas Prices In the student sample program files for this chapter, you will find a text file named Gas Prices.txt. The file contains the weekly average prices for a gallon of gas in the United States, beginning on April 5, 1993, and ending on August 26, 2013. Here is an example of the first few lines of the file's contents: 04-05-1993:1.068 04-12-1993:1.079 04-19-1993:1.079 04-26-1993:1.086 05-03-1993:1.086 and so on... 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
Chapter 9 Text Processing and More about Wrapper Classes
MM is the two-digit month, DD is the two-digit day, and YYYY is the four-digit year. Prices
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
and perform the following calculations:
Average Price Per Year: Calculate the average price of gas per year, for each year in the fie
(The file's data starts in April, 1993, and it ends in August, 2013. (For the years 1993 and
2013, use only the data that is present for those years.)
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
List of Prices, Lowest to Highest: Generate a text file that lists the dates and prices, so
amount for the lowest price, and the highest price.
from the lowest price to the highest.
List of Prices, Highest to Lowest: Generate a text file that lists the dates and prices, som
from the highest price to the lowest.
You can write one program to perform all of these calculations, or you can write dif
programs, one for each calculation.
Transcribed Image Text:Chapter 9 Text Processing and More about Wrapper Classes MM is the two-digit month, DD is the two-digit day, and YYYY is the four-digit year. Prices 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 and perform the following calculations: Average Price Per Year: Calculate the average price of gas per year, for each year in the fie (The file's data starts in April, 1993, and it ends in August, 2013. (For the years 1993 and 2013, use only the data that is present for those years.) 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 List of Prices, Lowest to Highest: Generate a text file that lists the dates and prices, so amount for the lowest price, and the highest price. from the lowest price to the highest. List of Prices, Highest to Lowest: Generate a text file that lists the dates and prices, som from the highest price to the lowest. You can write one program to perform all of these calculations, or you can write dif programs, one for each calculation.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 7 steps with 5 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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education