CS14 - At-Home Programming Assignment 1

Small demo in lab during week 2

Complete project due Tuesday, October 12 at 8:00 pm



In this project you will write a program for a phone company. Your program will use a list of lists to maintain the database of phone numbers. The main list will refer to the area codes. The lists coming off of the main list will store the telephone numbers in that area code. Each phone number should store the prefix and suffix seperately. Here is an example illustration:



Your program should be able to support the following actions: There are many List templates available (for example, the Standard Template Library offers a list template class). However, for this assignment, when you use a linked list, it will be your own code so that you can practice your programming and learn the concepts thoroughly. You may however, use any variation of a linked list (double linked list, sentinals, etc) as long as it interfaces with the main functions provided.

Skeleton code provided

So that your program will interface with our testing environment for grading, you must adhere to the following specifications and use the skeleton code provided. If you deviate from the specifications and your program does not interface with our testing environment, you program will not be graded. To ensure that your code will interface correctly, DO NOT alter any of the code provided to you. Please only ADD to the code.

Structure

Your program will consist of 3 basic classes and I have provided you with the skeleton code for those classes. DO NOT make any additional classes. You only need these 3 classes. You must download these files and complete the code in them.

Function prototypes

You will write the following functions for your PhoneBook class to interface with the main function. This is in no way an inclusive list of the functions that you will need to write. This is simply the minimum amount of information that I need to give you so that your code will interface with the main testing function. For each function, please follow the specifications listed above. You must also write the following function for the AreaNode class.

Error checking

Please make sure to provide good error checking throughout. If an error occurs, i.e inserting a duplicate number or deleting a number that does not exist, print out an error message and return from the function. Do not exit!

Small demo in lab during the second week

This project is most likely by far the largest programming assignment that you have ever been given and I am sure that it seems overwhelming. This project (along with every subsequent project you will be given this quarter) absolutely cannot be left until the last minute to complete. To help you complete this project, you will have an in lab demo during the second week of class. For in in lab demo, you will only need to operate on one area code. You will need to complete the size functions, the search function, and be able to insert 1 phone number. Please use the main_lab.cc file to test your code. You must demo your program with main_lab.cc during lab and it will account for a portion of your total score for the complete assignment.

Complete project due Monday, October 11 at 8:00 pm

For the completed project, please use the main.cc file to test your code. Your program must be turned in using the electronic turnin.

Notes on grading

Grading programming assignments can be a very time consuming operation if programs cannot be automatically tested with a test function. I would like to stress again how important it is for your programs to work with the main functions provided. Your programs will be graded with main.cc for the final complete project. You will receive points for the test cases that your code passes. If your code does not interface with main functions provided, you will not receive any functionality points (which is 70% of your grade for the assignment).

DO NOT, I repeat, DO NOT add anything to the main files that is necessary for your program to compile/function correctly. We will download a new copy of main.cc to test your program with.

Your output MUST match mine EXACTLY. This is my output. You need to determine if yours is exactly like mine by using the diff command. Do a man on diff for more information (type "man diff" at the command prompt). Basically, you need to run the following command in Linux: "diff youroutput.out main.txt" and if the files are the same, nothing will be printed to the screen (That is your goal). However, you don't have to get all test cases working, you can get extra credit. Make sure that the output matches exactly for the test cases that you are able to get working. To capture your output to a file, you can use the output redirection available in the Linux shell. You can redirect your output using > . To capture your output for this project, your command would look similar to this: "phonebook > youroutput.out" where phonebook might be the name of your executable and youroutput.out is what normally would have been printed to the screen. You will receive points for every test case that you get working. VERY, VERY IMPORTANT - you will NOT receive points for a particular test if the diff command fails for that test.

Much of the grading of your program will be based on not just getting code to do the necessary functions correctly, but on your actual coding (these points are part of the 70% listed above). Be sure to use good programming where possible (use of classes, functions, good parameter passing techniques, error checking, encapsulation, object oriented programming). Make sure your program is user friendly.

You must use a makefile to compile your program and you must at least use the compilation flags -W -Wall -Werror -pedantic. Programs will be graded under linux on hill.cs.ucr.edu. Significant points will be taken off if your program does not compile with a makefile or if you code under Windows.

Suggestions to follow while coding

What to turn in

You should have turned in what you have thus far on our program at least 6 hours before the due date (by 2pm). Then continue to work on your program and turn in more current versions as you get them working. Ideally, you should have your project done well before the due date.

You must turn in all .cc and .h files and your makefile. Furthermore, you must turn in a file called readme.txt that states which test cases your program passes and which test cases your program fails. In addition, you must follow any guidelines and include any information that is stated on the main page about at-home programming assignments.

DO NOT, I repeat, DO NOT turn in any files that are not required for the final compilation of your assignment. Do not turn in your temporary .cc files or your saved/olded revisions of your .cc files. This includes main_lab.cc. DO NOT turn that file in. If you turn in files that aren't required for your assignment, it hinders the grading processes. You will be docked points if you turn in extraineous files.

A reminder about collaboration on home programming assignments

Please remember, at-home programming assignments are not lab assignments and you may not team-code with your lab partner or any other individual. Limited collaboration may be acceptable, but programs must represent YOUR OWN original work. Sharing code or team-coding are strictly not allowed. Copying code from ANY source (any book, current or past students, past solutions, web, etc) is strictly not allowed even with citation. Collaboration may consist of discussing the general approach to solving the problem, but should not involve communicating in code or even pseudo-code. Students may help others find bugs. Your code MUST be unique -- the odds of randomly producing similar code is very low. Computing, like surgery or driving a car or playing golf, can only be learned by doing it yourself!