====================================================================== Faculty of Applied Science and Engineering, University of Toronto CSC181: Introduction to Computer Programming, Fall 2000 Practical Notes, Week 12: Classes ====================================================================== The purpose of this practical is to have you work with classes. You will not be graded for this practical. ---------- Your Tasks ---------- 1. A queue is a list of items, which are removed in the order they are inserted: first in, first out (FIFO). The first element is called the "head" element, and the last element is called the "tail" element. Operations for a queue are as follows: - enqueue(x): Append element x to the list. - dequeue(): Remove and return the first element in the list. - head(): Return the first element of the list. - isEmpty(): Return true if the queue is empty. - size(): Return the number of elements in this list. In a file called queue.cpp, Write a class Queue, which implements the queue abstract data type described above using a linked list. Assume the Queue class is used to store only integer elements. 2. Download p07.cpp from the course Web site and do the following: a) Fix the code so that whenever the 'print' function is invoked on a Circle instance, both its centre and radius get printed. Note that when the 'print' function is invoked on the lone Circle instance in the ShapeList 'shapes' inside the 'main' function, only the Circle's centre gets printed, but not its radius. b) Define your own subclasses of Shape and test them out. Try starting out with a Triangle.