Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Introduction: In this assignment you will be analyzing search queries from various engines. (A daunting task, like what does that even mean) In short you will prompt the user for the name of a file,

Introduction:

In this assignment you will be analyzing search queries from various engines. (A daunting task, like what does that even mean)

In short you will prompt the user for the name of a file, attempt to open said file, and if succeeded then you will begin to parse and output as follows.Each line will contain one search query (type a search into google and look at the URL, that thing)You are to parse each one for information and output it to a file while also tracking some information about everything you have parsed. (Ok those were some words lets break that down)

In short you will prompt the user for the name of a file, attempt to open said file, and if succeeded then you will begin to parse and output as follows.Each line will contain one search query (type a search into google and look at the URL, that thing)You are to parse each line for certain information, more on that later, and output this information to a file. While doing this you will track some information about the file. (Ok that was alot of words lets break that down)

Explanation:

For each input line: (all examples bellow are reffering to the following query (https://www.google.com/search?q=some+query&oq=some+query&aqs=chrome..69i57j0l5.2991j0j9&sourceid=chrome&ie=UTF-8))

  • You will grab the site that they are querying
    • would be google.com in this case
  • You will grab the query string
    • In this case it would be "some query"
    • Note it is not "some+query" but some query
  • You will grab any options (if there are any)
    • There are many of these in the above query
      • oq="some query"
      • aqs = "chrome...69i57j0l5.2991j0j9"
      • sourceid="chrome"
      • ie = "UTF-8"

For the file: 

  • Track the number of queries that were in the file
  • The average number of options (these count all things that are not the query string q)
  • Average length of the query string (just the q parameter)
  • Average length of the url

Output:

The output is split into two parts. The information for each of the individual url will output to a file and the output about the file statistics will be output to standard output (terminal).

Screen Output Example:Statistics for <filename>

-------------------------

Number of Queries: <number of urls in file>

Average length of URL: <average length of query>

Average length of query string: <average length of query string>

Average number of options: <average number of options>

File Output example:.

.

.

<site name>: <Query String>

-------------------

URL: <URL>

<option 1 name>: <option 1 value>

<option 2 name>: <option 2 value>

\n (this should be a blank line just put a newline)

.

.

.

Input:

Ask the user to enter the file name. Here is an example file

<URL 1>

<URL 2>

.

.

.

<URL n>

Requirements:

  • You must buld a namespace called "helpers" you will define any fuctions that help calculate (like averages) or manipulate (maybe some strings)
    • You are required to have at least two functions in this namespace
      • Calculating averages and maybe putting the spaces in the query string in place of '+' are good canidates
    • You may use more functions than this (and i recommend you do) but you must do the following
      • If the function is a "helper" (see the above explinations about what a helper is) is must be in the helper namespace
      • This will be mentioned bellow but you must document your function
        • Include what the function does and what the parameters are
  • You must build a namespace called "interface" you will define any functions that help you prompt the user / print to file
    • You are required to have at least two functions in this namespace
      • Printing information to the screen (standard input), maybe your final output to the screen would be a good canidate
      • Another would be a function that prints a line and the corsponding "----" line that will match up with it
    • You may use more functions than this (and i recommend you do) but you must do the following
      • If the function is a "helper" (see the above explinations about what a helper is) is must be in the helper namespace
      • This will be mentioned bellow but you must document your function
        • Include what the function does and what the parameters are
  • All functions must be documented above a prototype
  • Each time a line has "----" (dashes under it)
    • The dash line must be the same length as the line above it

Previous Module: 

Week 9" style="float: left;">Previous Quiz #6" style="float: right;">Next

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question