Sale!

Assignment 3 COP 3514 Program Design

$30.00

Category:

Assignment 3
COP 3514 Program Design

1. John Smith spends a lot of time on Internet websites. He does Internet shopping, spends
time on social networking sites and plays a lot of games. He noticed that his web browser
provides suggestions of items for him to buy, or sites for him to visit based on his browsing
history. He thinks that the algorithm that is being used is not efficient and the suggested
items and sites are not very useful for him. John decided to create his own data mining
algorithm that will use his browsing history to find and suggests items or sites that he
might be interested in. Part of this project involves URL filtering and parameter and value
extraction. An example URL format is:
“ http://example.com/shop/index.php?product_id=58&highlight=blue+shoes&cat_id=5&sessionid=123&affid=543”
To filter the URL, John wants to discard anything after the ‘?’ character including the ‘?’.
He also wants to extract all of the parameters and values. A string is a parameter if it is
either after the ‘?’ character or after any ‘&’ character. A string is a value of a parameter
if it is after any ‘=’ character and ends at the ‘&’ character or at the end of the URL.
In this assignment you are to create functions that filter an URL and extract the
parameters and their values and store them in arrays.
Files:
You are provided with the files:
Assignment3.c
Assignment3.h
main.c
Makefile.
You are to complete the functions in Assignment3.c
You are NOT to modify Assignment3.h
You can use main.c to test the correctness of the functions.
Output format of the print() function:
The URL is: [filtered URL]
There are [number of parameters] parameters and [number of values] values.
Parameter [number of parameter]: “[name of parameter]” with [value of parameter/no value]
It is OK to have parameters with no values but you cannot have values with no parameters. If
this is the case the output should be “URL ERROR” (see Example 5 and 6)
Grading:
Your code will be tested with 9 regular test case inputs (10 points each) and 2
special test case inputs (5 points each)
Submission:
Submission should be done only through Blackboard.
Compiling and testing:
To compile your file make sure all of the files are in the same directory. Type
“make –always-make” in the terminal in the directory of the files. If there
are no compilation errors a main executable will be created.
To test your program run “./main” from the terminal in the directory of the
files.
Following are few examples that will clarify how the output should be formated.
Note: The examples also show how many newlines should be added after each
message. Red font indicates inputs by the user.
—————————————————————————————————————————-
Example 1:
—————————————————————————————————————————-
http://example.com/shop/index.php?product_id=58&highlight=blue+shoes&cat_id=5&sessionid=123&affid=543
The URL is: http://example.com/shop/index.php
There are 5 parameters and 5 values.
Parameter 1: “product_id” with value “58”
Parameter 2: “highlight” with value “blue+shoes”
Parameter 3: “cat_id” with value “5”
Parameter 4: “sessionid” with value “123”
Parameter 5: “affid” with value “543”
—————————————————————————————————————————-
Example 2:
—————————————————————————————————————————-
http://example.com/shop/index.php?product_id=&highlight=blue+shoes&cat_id=&sessionid=123&affid=543
The URL is: http://example.com/shop/index.php
There are 5 parameters and 3 values.
Parameter 1: “product_id” with no value
Parameter 2: “highlight” with value “blue+shoes”
Parameter 3: “cat_id” with no value
Parameter 4: “sessionid” with value “123”
Parameter 5: “affid” with value “543”
—————————————————————————————————————————-
Example 3:
—————————————————————————————————————————-
http://example.com/shop/index.php
The URL is: http://example.com/shop/index.php
There are 0 parameters and 0 values.
—————————————————————————————————————————-
Example 4:
—————————————————————————————————————————-
http://facebook.com/index.php?name=John&last_name=Smith
The URL is: http://facebook.com/index.php
There are 2 parameters and 2 values.
Parameter 1: “name” with value “John”
Parameter 2: “last_name” with value “Smith”
—————————————————————————————————————————-
Example 5:
—————————————————————————————————————————-
http://facebook.com/index.php?name=John&=Smith
The URL is: http://facebook.com/index.php
URL ERROR
—————————————————————————————————————————-
Example 6:
—————————————————————————————————————————-
http://example.com/shop/index.php?=58&highlight=blue+shoes&cat_id=5&sessionid=123&affid=543
The URL is: http://example.com/shop/index.php
URL ERROR

Reviews

There are no reviews yet.

Be the first to review “Assignment 3 COP 3514 Program Design”

Your email address will not be published.