Computer science programming

computer science

Description

Attached is the web log file required to run within this program. 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.csc2.sort.clean holds the details of some of those requests.


This file does not include all possible information that could be collected by a web server. 


For this project, you can use each line of the web log file as one string. Remember, each line of the file represents one-page request.

Requirements:

  • Create a class that includes the following functions to work with the weblog.cppfile:
  • void openWebLog(); a function to open the weblog.txtfile. Save each line of the file in a string array or vector of strings that is defined as a private data member of the class so all of the functions can access it. Line 1 of the file will be in index 0 of the array or vector.  Line 2 of the file will be in index 1 of the array or vector, and so on.
  • int size(); a function to return the total number of lines in the weblog.  Your main function should then display the return value.
  • void lineNum( int index); a function to display a line from the file when a line number is provided.  Your main function should send over an index number in the parentheses when it calls this function. Use the index number of the array (+1) to pull the requested line from the array or vector.
  • Create a main function in a separate .cppfile that creates an object of your class and calls each of the functions. Remember to #include your header file!


Related Questions in computer science category