Free University of Bolzano/Bozen
Faculty of Computer Science - Bachelor in Applied Computer Science
Introduction to Programming - A.Y. 2006/2007

Exercise 12

Exam Exercise


Implement a class Tape. An instance of Tape represents a video tape that can hold recorded television programs. For each program recorded on a tape, the following properties are of interest:

Each tape has a certain capacity (in minutes) and each recorded program starts at a certain position on the tape. The positions are numbered as 0, 1, 2, 3, ... The class Tape should implement the following features:


Part 1
Implement a class Tape using a linked list to store informations about the programs on the tape.

Solution: representation of the objects, skeleton of the class, class Tape


Part 2
Implement a client class for Tape. It should have a static method that, given a Tape instance and a file name as parameters, writes the program listing (name and length of each recorded program) to the file. The static method should also write the total length of all recorded programs and the residual capacity of the tape to the same file.

Solution


Part 3
Implement a test program that creates a Tape, records a few programs on it and then calls the static method from part 2 to write the tape's information to a file.

Solution