COMP 104 : Programming
Lab
11: Star Wars movie player
(using class)
In Lab11, you will redo lab
10 using a class with the name player.
Here are some text files you can use to test your movie player: scene1.ani, scene2.ani,
scene3.ani, starwar.ani
(1.8Mb, just for fun if you have finished the lab assignment)
Your
program still have the following functions:
1.
play forward
2. play backward
3. pause
4. stop
5. delete current frame
6. duplicate current frame
You must hand in 3 files: lab11.h which has the class
player defintion and Node defintion, lab11.cpp which implements the
member functions of the class, main.cpp which has the main function.
Here is
the skeleton of main.cpp and you cannot modify it.
Requirements:
For all member functions in class player, you are
not allowed to pass pointers (e.g., void play_forward(NodePtr &ptr) is not allowed), so you may need to store a private
data member instead (e.g., NodePtr Cur). Therefore functions in lab10 have to be changed.
The class
definition should be something like:
class player{
public:
//member functions
private:
NodePtr
Head;
NodePtr
Cur;
};
Note that Head and Cur must be private.
You must
write the constructor for the class. Default
constructors are not
allowed.
Except for constants,
your program should not use global variables.
You should use a
doubly linked list to store the frames.
Your program must not
have any memory leaks or dangling pointers.
Use the following structure
(note that it is a user-defined data type, not a variable):
struct Node{
string frame;
Node* next;
Node* prev;
}
typedef Node* NodePtr;
Demo your working program for your TA. If for some reason you cannot
finish before the end of the lab period, email your program to your TA
by Sunday 4 December 5PM (please include your name and lab section as a
comment on line 1 of your program).