代写 data structure Java database software network Open Quick Links

Open Quick Links
Quick Links

Logout
Global Menu
 Shanshan LiActivity Updates

Top Frame Tabs
My SDSU Tab 1 of 2
Courses Tab 2 of 2 (active tab)

Current Location

1. CS310-02-Spring2019 DATA_STRUCTURES  

2. Assignments

Menu Management Options
• 
• 
Course Menu:
CS310-02-Spring2019 (DATA_STRUCTURES)

• Assignments
• 

• Data Structures YouTube Videos
• Course Videos
• Reading Assignments
• 

• Exams and Answers
• Quizzes
• 

• Announcements
• Syllabus
• Faculty
• Discussions
• 

• Tools
• My Grades
• SDSU Library
• Student Services

Assignments

Content
•   Assignment 2 



Assignment 2
Due Date: Tuesday 04/11/19 at 11:59:59 PM (the end of the day)
For this assignment, you will develop a utility to assist a network administrator with internet resource management. On the internet all machines are identified by a number, an IP address. Most machines still use IPv4 technology, that has its limitations: there were only 4,294,967,296 (232) possible addresses, and we have already exhausted those. In your networking and systems administration classes you’ll learn that we are moving from IPv4 to IPv6 that has 2128 addresses, however for Data Structures, we’ll stick with IPv4 – its simpler!
At SDSU there are three major networks. Your internet connected devices (computers, cell phones, tablets, etc) are probably on either the 146.244.0.0 network (if you connect to SDSU_Guest) or the 10.130.0.0 network (if you connect to eduroam). The first number (146 or 10) represents the network, and the second number (246 or 130) is the first level of the subnet. These two are “private” networks in the sense that most (or all) of the machines on these networks are not visible to the rest of the world – they are behind the SDSU Campus Firewall. It is a hidden layer of protection that stops your phone, tablet, and laptop being hacked! In addition, most of the machines on these two networks get their IP addresses dynamically. From time to time your IP address changes. This is invisible to you – you can still connect to the internet, but your device may have a different network. The other network that SDSU runs is the 130.191.0.0 network. This is a “public” network and many (but not all) of the machines are visible outside the SDSU firewall, and most of the machines on this network are assigned to a specific computer. This means, for example, when you type in sunspot.sdsu.edu into your browser you always end up at the machine with the IP address 130.191.15.168. The connection between the name that you type into the computer and the IP address of the machine is handled by a domain name system resolver.
For Assignment 2, you are going to write a simple DNS resolver that takes a URL address and an IP address and stores them, and then when given a URL returns the IP address associated with that URL. Your project will provide tools to add, modify, remove and search a database of IP addresses using a chained hash. Your project will use the HashI interface (provided in your accounts) to support your application program. The hash takes key/value pairs. Each key must be distinct; no duplicates are allowed. The key is an instance of the URL class that you will write and the value is an instance of the IPAddress class that you will also write.
I have provided the outline code for your assignment in your GIT repositories, and you can check it out using the same procedure that we used for previous assignments. Follow the instructions here but remember that this is called Assignment2 (and so you just need to change the Assignment part of the checkout procedure).
Once you have checked this code out, your Eclipse should look like this:
  



The data directory contains two files:
◦ ips_small.txt has 21 IP addresses and associated URLs. This is a small file that you can use for development and testing
◦ ips.txt has 2,824 IP addresses and associated URLs from the 130.191.0.0 network on campus.
• The data_structures directory contains four files:
◦ HashI.java is the interface for the Hash data structure (provided for you)
◦ HashListI.java is the interface for the Linked List that you will use for the Hash data structure (provided for you)
◦ Hash.java is the Hash data structure that implements the methods described in the HashI interface. This must have a constructor that takes an int and creates a hash with a table of that size.
◦ LinkedList.java is the linked list that implements the methods described in the HashListI interface. Note that the HashListI interface is different from the ListI interface in Assignment1, and thus the methods in this linked list are different from those in the linked list of assignment 1.
• The dns_reolver directory contains four files:
◦ DNS_Resolver.java is an executable that will ask you for a URL and will return the IP address (provided for you).
◦ IPAddress.java is a class that will hold the IPv4 address from the text file. See below
◦ LoadInternetAddresses.java is a class that will parse a file, create URL and IPAddress objects, and return a populated hash. See below
◦ URL.java is a class that will hold the URL information, see below
• The exceptions directory contains a single file:
◦ The FileFormatException.java class that is an exception that you will throw if the file is not formatted correctly. The ips.txt and ips_small.txt file has two columns, separated by a tab. The first column is the IP address, and the second column is the URL of the machine. If the file that is presented to the LoadInternetAddress class does not conform to this standard you will throw a new FileFormatException
with an appropriate error message.
• The Hash
The hash should accept generic data. For the assignment we will use URL and IPAddress objects, but for testing purposes you may want to use String or Integers. I will test your code with other objects!
We consider that two objects are the same if their keys are the same, but not their values (this allows us to change the value associated with a key). Similarly, you should use the key to insert the object at the appropriate point in the hash array.
You will need to make an array of generic linked lists (e.g. LinkedList>[] hash_array = (LinkedList>[]) new LinkedList[tablesize];)
The hash should be resized once the current load factor exceeds the maximum load factor. You can check the load factor either before or after you add something to the hash. You do not need to shrink the size of the hash when you remove things.
IP Address Class
The IP Address class will have a constructor that accepts a string (public IPAddress(String ip)) and parse that string into components. You should use the Java split method (i.e. String data[] = ip.split(“\\.”);) to split the IP address into its component subnets. Each of those should be stored as a separate variable. You will then need to write the appropriate classes for an Object (hashCode, toString, equals, and compareTo).
URL Class
The URL class will have a constructor that accepts a string (public URL(String url)) and accept a string from the LoadInternetAddresses class that represents the URL associated with an IP address. You do not need to split the URL into its components. The URL class should override the appropriate methods from the Object class, and in addition, it should be able to compare a URL to another URL using the compareTo method.
LoadInternetAddresses Class
This class has a public method that accepts the name of a file (as a string) and opens it using the buffered reader class (e.g. new BufferedReader(new FileReader(filename));). For each line in the file, split it with a tab (e.g. String [] values = line.split(“\t”);) and convert the two components to an IPAddress object and a URL object. Those objects are added to the hash.
Additional Details:
◦ Your project must consists of only the files specified, no additional source code files are permitted.
◦ The class names, and signatures of all public methods must exactly match the above specifications. I WILL USE CODE TO GRADE YOUR ASSIGNMENT, IF IT CAN NOT FIND THE METHODS YOU WILL LOOSE MARKS.
◦ You may have as many private methods, variables, and inner classes as you need.
◦ You may use any class in java.lang. No import statement is required for the java.lang package.
• Javadoc
You need to comment all the methods that you write, in all the classes that you write, using Javadoc. There is a simple description on wikipedia, and a more thorough description on Oracle’s website.
Project Submission:
You must submit your code to the git repository. You can do that using Eclipse (or your favorite IDE).
Grading policy
Grades will be assigned as discussed in class and include:
◦ 10% for git commits. You should commit and push your code to the git repository at least twice per week. I will check the history to see how often you submit code.
◦ 10% for Javadoc. Your code should include appropriate Javadoc comments for all methods — include those that implement interface methods whether or not the interface has comments.
◦ 70% for code that compiles without error, and runs the program as described.
▪ 50% of the total grade will be for a working data structures, so you should ensure that you have those working.
◦ 10% for coding style. Pay attention to the Good Programming Practices of Riggin’s reader.
• 

File output
Your files should not print out extraneous information (for example, debugging or other information). None of the classes described here except DNS_Resolver need to print out anything. You will loose marks if your code prints out things it does not need to.

Submitting Your Work
The last time stamp that you submit your work to the git repository will be the time used for the submission. You should submit your work to git before the deadline to avoid a late penalty.

Early Work
You can receive 5% per day extra credit for submissions completed early. The deadline for this assignment is the end of the day on 04/11/19. Therefore, submissions received before the end of the day (11:59:59 pm) 4/8/19 will receive +15% extra credit, those received between midnight at the beginning of 4/9/19 and the end of the day on 4/9/19 will receive +10% extra credit, those received between the beginning of the day 4/10/19 and the end of the day 4/10/19 will receive +5% extra credit.

Late Work

Pay very careful attention to the deadline. Late work is heavily penalized, and you are usually better off submitting partially complete work than waiting until the very final deadline. If your code is two days late, you will not be able to get an A. If your code is four days late you will not be able to get a B. The late penalty (5% per day) is subtracted from your total based on the above criteria. Work will not be accepted nor graded more than 7 days after the deadline for the assignment.

Java API
You are not allowed to include any of the java.util classes in this work except those explicitly allowed. You must not import java.util.*. In fact, you should never import java.util.*, not just in the class, ever!

Honesty policy
The work that you commit and turn in should be your own work. You may discuss ideas and concepts with other students, but you should never, under any circumstances, copy code from another student. I will use some automatic software to detect cheating (see the course description on blackboard), and will report people who cheat in this class to the Center for Student Rights and Responsibilities.This page maybe updated during the period that the assignment is active in response to questions or comments.