CS 630 - Computing Fundamentals I - Spring 2004
Project


Loyola College > Department of Computer Science > CS 630 > Project

Due

Thurday, April 22th at the beginning of class. Projects will be penalized 20% for each day after the due date. Projects will not be accepted more than four days late.

Objectives

Introduction

Imagine Tivo is developing its next generation product which will use profiles of individual family members to determine which shows to record. We will develop a class to represent a viewer profile. One instance of this class will contain all the information Tivo associates with a particular person. There will be fields for the viewer's name, age, gender, show preference, maximum number of hours that Tivo can record for that person, the number of hours that have been recorded, and an array that stores the ids of the shows that have been recorded. No person can record over 100 shows at a time. (We will assume that equal length programs take up the same amount of space on the hard drive.) This class will also have several methods that will record and erase shows based on the profile, and other methods that will access the information stored in the profile.

A sample profile might look like:

Since we are developing a "Tivo2" prototype, there will be some limitations to our software. First, we will deal only with a subset of genres: comedy, reality, sci fi, soaps, and sports. Second, we will record shows based on the viewer's preference and demographic information only. We will use the following demographic rules:

In our system each show will be identified by a unique 12 digit number. The first number will indicate the rating, the second the genre, numbers 3 through 6 will be the number of minutes the show runs, and the final six numbers indicate the unique show id.

Number representation

Both Rating and Genres will have associated numeric values, which are listed in the following tables. Shows can run for a maximum of 9999 minutes, and for our purposes the six digit unique id can be generated randomly.

Rating Table

NR 1
G 2
PG-13 3
R 4

Genre Table

Comedy 0
Reality 1
Sci Fi 2
Soaps 3
Sports 4
Using the above information a show number of 320060388474 would indicate that show 388474 is a Science Fiction show rated PG-13 which runs for 60 minutes.

Ratings will be used to determine if a family member can record a particular show. Shows rated NR and G can be recorded by members of all ages. Shows with a rating of PG-13 can only be recorded by those 13 and older, and shows with a rating of R can only be recorded by those 17 years and older.

Assignment

Write a class called Tivo2. This class should have at least the following attributes:

You should also write a test driver to test your methods thoroughly.

Assume that all Show Ids are strings that consist of numbers rather than longs. After testing the long, I found that it is the same size as an int in C++. This means that you can use the substr method to isolate the part of the string you want and than call atoi(sub.c_str()) to get the integer value.

Grading

Submissions

Submit the source code for your Tivo2 class and your test driver.