////////////////////////////////////////////////////////////////////// // Project 2 for CS 1704 Spring 2004 // // Programmer: Michael Tuozzo // OS: Windows XP Professional // System: Mobile Pentium 4, 1.2/2.2 GHz, 512 MB Memory // Compiler: Visual C++ 6.0, Service Pack 4 // Last modified: February 18, 2004 // // Class Name - mmcontroller // Description - This class is a multimedia organizer class. It // maintains a list of students and a list of items // supports insertion, deletion, and printing of info // stored in the lists. ////////////////////////////////////////////////////////////////////// #include "student.h" ///////////////////////////////////////////////// // Function Name - student // Description - default constructor // // Parameters: none // Pre: none // Post: object is initialized // Returns: none // // Calls: none ///////////////////////////////////////////////// student::student(){name = phnumber = email = addressline1 = addressline2 = city = state = zipcode = other = "";} ///////////////////////////////////////////////// // Function Name - student // Description - copy constructor // // Parameters: student& // Pre: none // Post: object is initialized // Returns: none // // Calls: none ///////////////////////////////////////////////// student::student(const student &tocopy){ name = tocopy.name; phnumber = tocopy.phnumber; email = tocopy.email; addressline1 = tocopy.addressline1; addressline2 = tocopy.addressline2; city = tocopy.city; state = tocopy.state; zipcode = tocopy.zipcode; other = tocopy.other; } ///////////////////////////////////////////////// // Function Name - clear // Description - clears student's info without destruction // // Parameters: none // Pre: none // Post: object is cleared // Returns: none // // Calls: none ///////////////////////////////////////////////// void student::clear(){ setname(""); setphnumber(""); setemail(""); setaddress1(""); setaddress2(""); setcity(""); setstate(""); setzipcode(""); setother(""); } ///////////////////////////////////////////////// // Function Name - print // Description - prints student's info // // Parameters: ofstream& // Pre: none // Post: student's info will have been printed // Returns: none // // Calls: none ///////////////////////////////////////////////// void student::print(ofstream& output){ bool first = true; if( name.length() > 0 ){ first = false; output << "Name:\n " << name;} if( phnumber.length() > 0 ){ if( first ) first = false; else output << endl; output << "Phone Number:\n " << phnumber;} if( email.length() > 0 ){ if( first ) first = false; else output << endl; output << "Email:\n " << email << endl;} if( addressline1.length() > 0 || addressline2.length() > 0 || city.length() > 0 || state.length() > 0 || zipcode.length() > 0 ) output << "Address:"; if( addressline1.length() > 0 ) output << endl << " " << addressline1; if( addressline2.length() > 0 ) output << endl << " " << addressline2; if( city.length() > 0 || state.length() > 0 || zipcode.length() > 0 ) output << endl; if( city.length() > 0 ){ output << " " << city; if( state.length() > 0 || zipcode.length() > 0 ) output << ",";} if( state.length() > 0 ) output << " " << state; if( zipcode.length() > 0 ) output << " " << zipcode; if( other.length() > 0 ) output << endl << "Other:\n " << other; output << endl << endl; } ///////////////////////////////////////////////// // Function Name - ~student // Description - destructor // // Parameters: none // Pre: none // Post: object is destroyed // Returns: none // // Calls: none ///////////////////////////////////////////////// student::~student(){name = phnumber = email = addressline1 = addressline2 = city = state = zipcode = other = "";}