Question: For this project, download the text file weblog.txt http://srjcstaff.santarosa.edu/~lmeade/weblog.txt Note: To download this file, right click on the link and select SAVE AS or SAVE

For this project, download the text file weblog.txt http://srjcstaff.santarosa.edu/~lmeade/weblog.txt Note: To download this file, right click on the link and select SAVE AS or SAVE TARGET AS

This file is an Apache web log taken from the web server for St. Mary's University. When a visitor goes to their web site, the visitor's browser makes a request to the web server to view a web page, which is a file residing on the server. Each time a page is requested by a browser, the web server records information about that request. This weblog.txt holds the details of some of those requests. See below for a list of fields with an example:

Web Log Example http://srjcstaff.santarosa.edu/~lmeade/weblog.html

This file does not include all possible information that could be collected by a web server. The full description of the apache log file format can be found here:

http://httpd.apache.org/docs/2.2/logs.html

For this project, you can use each line of the web log file as one string.

Minimum Requirements:

Create a method to read each line of the web log file. This method must use exception handling to ensure that the file is opened successfully (4 points).

Each line of the file should then be stored in a collection class object such that the first element of the collection is the first line of the web log file. You can choose any of the collection classes covered in this module unit. Because each element will hold an entire line from the file, the collection should be declared as a collection of strings (4 points).

Create another method to write the contents of the collection to another file in reverse order. Each element should be on its own line in the new file. The contents of the new file should look like the original input file once your program completes, but in reverse order, so that the last line of the original file will be the first line of the new file and so on (4 points).

Create another method that will display the first five lines only from the collection (not from the file) (2 points).

Create a main function (2 points). Test your code by verifying the contents of the newly created file. The file is somewhat large, so not display the entire contents of the file!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!