University of Arkansas



CSCE 2004 - Homework 6Due Date – Thursday April 16, 11:59pm1. Overview The primary goal of this programming assignment is to give students experience defining, implementing and using classes in their programs. In addition, this programming assignment will give students experience with reading content from files. In particular, you will develop a program which can translate URLs to ip addresses and ip addresses to URLs. Your task is to create a “DNS” class which has two arrays associated with it: an array to hold ip addresses and an array to hold URLs. Your “DNS” class should implement the following public methods:Constructor – Sets all elements of both arrays equal to the empty string, and set the number of entries equal to 0.Destructor - to destroy any dynamically allocated data (there isn't any)FillArraysFromFile – Fills the two arrays with ip addresses and URLs from a file (the file name is passed in as an argument). We have provided a sample file “list.txt” that contains an ip address, a space, and then a URL. AddWebsite – Adds an ip address and a URL to the two arrays LookupWebsiteURL – Takes an ip address as an argument and returns the URL associated with the ip address or the string “nonexistent” if the ip address is not found in the arrayLookupIPAddress – Takes a URL as an argument and returns the ip address associated with the URL or the string “nonexistent” if the URL is not found in the array Print – Prints out the contents of the lookup table. URLs and ip addresses associated with each other should be printed on the same line.(BONUS) IsValidIP – Returns true if the string passed as an argument is 1) between 7 and 15 characters long, 2) contains nothing but periods and digits, and 3) contains exactly three periods, and returns false otherwise.(BONUS) IsValidURL – Returns true if the string passed as an argument begins with “” and contains exactly two periods, returns false otherwise.In addition, fill out the bodies of the main function and the AddWebsite function that prompts the user for the ip address and website URL. useDNS.cpp should be capable of performing each of the options listed in the menu displayed by the getChoice function2. Design: Normally object oriented design begins with an analysis of the data and operations that belong together. In this case, you have been given a skeleton, so you only need to worry about how to store and manipulate the data by completing the method bodies and effectively using the methods in the main program.3. Implementation: Copy all the files to a separate directory for hw6. Run "make" on the command line to compile the provided code; then "./hw6" to run plete the DNS class one method at a time and test it. Start with the default constructor and Print. For each method:Write a simple method body (just cout and/or set parameters to "test") in DNS.cppCompile and test the simple version of the methodFill in the real body of the methodCompile and test the real version of the methodBe sure to implement all of the methods described in DNS.h. Be sure to complete and test one method before writing code for the next.Note: You are?NOT ALLOWED?to change the method prototypes in DNS.h.4. Testing: Test your program to check that it operates correctly for all of the requirements listed above. You can collect the output in a file using a linux utility called script. Before running script, type “make clean”. Script captures everything that appears on the screen to a file. You should capture your program compiling without errors and then a couple test runs of your program with correct and incorrect inputs. When you are done, type exit. This creates a file called typescript that you should include in your report. prompt$ scriptprompt$ makeprompt$ ./hw6 (one test) prompt$ ./hw6 (another test) prompt$ ./hw6 (another test) prompt$ exit prompt$ exitprompt$ mv typescript MYID.typescript.txt (rename file before submission) 5. Documentation: When you have completed your C++ program, write a short report using the project report template describing what the objectives were, what you did, and the status of the program. Describe the test cases you included in your typescript. Does it work properly for all test cases? Are there any known problems? Save this report to be submitted electronically. There is a report template on the class web site which you should use.Include the typescript file captured during testing as an appendix at the end of the document. 6. Project Submission: In this class, we will be using electronic project submission to make sure that all students hand their programming projects and labs on time, and to perform automatic analysis of all programs that are submitted. Rename your program and documentation files and typescript: 123456789.useDNS.hw6.cpp123456789.DNS.hw6.cpp123456789.useDNS.hw6.h123456789.Makefile.hw6.txt123456789.hw6.docx or .doc or .pdf or .txt 123456789.hw6.typescript.txt using your UAID number in place of 123456789. Only one student of the pair should do this. Use the Blackboard site for this class to submit these three files (or you can include the typescript as an appendix within your report). The dates on your electronic submission will be used to verify that you met the due date above. All late projects will receive reduced credit: 10% off if less than 1 day late, 20% off if less than 2 days late, 30% off if less than 3 days late, ? no credit if more than 3 days late. You will receive partial credit for all programs that compile even if they do not meet all program requirements, so handing projects in on time is highly recommended. If your program does not compile, the correctness section of the project score will be a 0. This leaves 50 possible points for the project design, implementation, testing and report. 7. Academic Honesty Statement: · Students are expected to submit their own work on all programming projects, unless group projects have been explicitly assigned.· Students are NOT allowed to distribute code to each other, or copy code from another individual or website. · Students ARE allowed to use any materials on the class website, or in the textbook, or ask the instructor and/or GTAs for assistance. This course will be using highly effective program comparison software to calculate the similarity of all programs to each other. Please do not be tempted to plagiarize from another student. Violations of the policies above will be reported to the Provost's office and will result in a ZERO on the programming project, an F in the class, or suspension from the university, depending on the severity of the violation and any history of prior violations. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download