
March 18th, 2006, 10:54 PM
|
|
Registered User
|
|
Join Date: Feb 2006
Posts: 18
Time spent in forums: 7 h 6 m 23 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by jandali
Code:
Original
- Code |
|
|
|
#ifndef _TREENODE_H
#define _TREENODE_H
#include "studentRec.h"
class treeNode {
private:
studentRecord *data;
treeNode *left, *right;
public:
// the default constructor
treeNode(studentRecord* _student);
// the destructor
~treeNode();
// sets the next child of the treeNode.
void setLeftChild(treeNode *newLeft);
// sets the right child of the treeNode
void setRightChild(treeNode *newRight);
// gets the next child of the treeNode.
treeNode *getLeftChild();
// gets the right child of the treeNode
treeNode *getRightChild();
// returns a pointer to the student record the treeNode contains.
studentRecord* getStudentRec();
}; //treeNode
#endif
|
Code:
Original
- Code |
|
|
|
#ifndef _STUDENTREC_H
#define _STUDENTREC_H
#include <string>
using std::string;
#define NUM_OF_MARKS 5 // indexed 0-4
class studentRecord {
private:
unsigned int studentNumber;
string _firstName;
string _lastName;
unsigned int marks[NUM_OF_MARKS];
public:
// the default constructor
studentRecord();
// the destructor
~studentRecord();
// sets the student number of the record to studentNum.
void setStudentNumber(unsigned int studentNum);
// sets the student first name to firstName.
void setFirstName(string firstName);
// sets the student last name to lastName.
void setLastName(string lastName);
// sets the mark at index "index" of the student record to mark.
// the method assumes the index is in 0-4 range, and
// the mark is in 0-100 range.
void setMark(int index, unsigned int mark);
// returns the student number.
unsigned int getStudentNumber();
// returns the first name of the student record.
string getFirstName();
// returns the last name of the student record.
string getLastName();
// returns the mark at index "index" of the student record.
// it assumes the index is in 0-4 range.
unsigned int getMark(int index);
// prints the student record to the standard output in the format
// specified in the assignment specifications.
void print();
}; //studentRecord
#endif
|