CSCE 2014 - Homework 1
Due Date - 02/03/2012 at 11:59 PM

1. Problem Statement:

The popular website YouTube has a HUGE database of digital video and related meta-data describing this video. The purpose of this programming assignment is to create a small memory-based database of video meta-data that allows users to insert and search for video clips. To implement our pseudo-database, we will be using an array of Video objects to gain experience with this simple data structure.

2. Design:

  • Create a C++ class called "Video" that contains at least five private data fields that describe the video. For example, the video title, the name up the creator, the upload date, the length of the video, the content category, the average user rating. You are welcome to make up any fields you want, but keep things PG.

  • In addition to the default constructors and destructor, add methods that will let you "get" and "set" each of these private variables. Finally, add a "print" method to the class to output all of the data in an object.

  • Create a "test" function in your main program to test the "Video" class. Your function should call each of the methods above and verify that the correct results are returned.

  • Create a "read" function in your main program that opens an ascii file called video.txt and reads the data in this file into an ARRAY of Video objects. The input file will start with an integer N which is how many video records are in the file. After this, there will be a sequence of video records, with the data fields you invented on separate lines. A blank line will separate video entries to improve readability. This format will allow you to use the "getline" method to read this data from the file, and "atoi" and "atof" to convert strings to numbers. Use the "print" method to debug your input function.

  • Create "search" function in your main program that implements a menu-based interface for users to search your array of Video objects for video they are interested in. Again, you should use "getline" to read input from the user, and use "print" to display information about all video that match the user's request. Test your program with several queries you know will succeed, and several you know will fail.

    3. Implementation:

    You can implement this program using either a bottom-up approach or a top-down approach. If you go for a bottom-up approach, start by creating basic methods and classes, and test theses methods using a simple main program that calls each method. When this is working, you can create the main program that uses these methods to solve the problem above.

    If you go for a top-down approach, start by creating your main program that reads user input, and calls empty methods to pretend to solve the problem. Then add in the code for these methods one at a time. This way, you will get an idea of how the whole program will work before you dive into the details of implementing each method and class.

    Regardless of which technique you choose to use, you should develop your code INCREMENTALLY adding code, compiling, debugging, a little bit at a time. This way, you always have a program that "does something" even if it is not complete.

    4. Testing:

    Test your program to check that it operates correctly for all of the requirements listed above. Also check for the error handling capabilities of the code. Try your program on 2-3 input documents, and save your testing output in text files for submission on the program due date.

    5. Documentation:

    When you have completed your C++ program, write a short report (less than one page long) describing what the objectives were, what you did, and the status of the program. Does it work properly for all test cases? Are there any known problems? Save this report in a separate text file to be submitted electronically.

    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. When you have completed the tasks above go to the class web site to "submit" your documentation, C++ program, and testing files.

    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 (50% off if less than 24 hours late, no credit if more than 24 hours late), so hand in your best effort on the due date.

    You should also PRINT a copy of these files and hand them into your teaching assistant within ONE DAY of the due date. This can be done during class, during lab, or using the department mailbox. Attach a copy of the Programming Project Evaluation Form to your report with your name and project number filled in.