// Project 2 for CS 1704 Spring II 2004 // // Programmer: Mason Shea // OS: Windows XP // System: Pentium III 500, 256 MB Memory // Compiler: Visual C++ 6.0, Service Pack 4 // Last modified: February 25, 2004 // // Purpose // The purpose of this file is to describe the implementation for the data type // student, in other words, it contains the implementation for all the previously // declared member functions of the Student class #include "students.h" Student::Student() //defualt constructor, sets all values to default values { myName = "nothing"; myPhoneNumber = "nothing"; myEmail = "nothing"; myAddressLine1 = "nothing"; myAddressLine2 = "nothing"; myCity = "nothing"; myState = "nothing"; myZipcode = 0; myOther = "nothing"; } Student::Student(string Name, string PhoneNumber, string Email, string AddressLine1, string AddressLine2, string City, string State, int Zipcode, string Other) //constructor is sent all of the possible students fields, and assigns them accordingly { setName(Name); setPhoneNumber(PhoneNumber); setEmail(Email); setAddressLine1(AddressLine1); setAddressLine2(AddressLine2); setCity(City); setState(State); setZipcode(Zipcode); setOther(Other); } Student::Student(const Student &student) //copy constructor is given a student and makes the students information that particular student's information { myName = student.myName; myPhoneNumber = student.myPhoneNumber; myEmail = student.myEmail; myAddressLine1 = student.myAddressLine1; myAddressLine2 = student.myAddressLine2; myCity = student.myCity; myState = student.myState; myZipcode = student.myZipcode; myOther = student.myOther; } //these are mutator operations of the Student class; they are given on data field of a student, and change that student's current data to the given one's void Student::setName(string Name) { myName = Name; } void Student::setPhoneNumber(string PhoneNumber) { myPhoneNumber = PhoneNumber; } void Student::setEmail(string Email) { myEmail = Email; } void Student::setAddressLine1(string AddressLine1) { myAddressLine1 = AddressLine1; } void Student::setAddressLine2(string AddressLine2) { myAddressLine2 = AddressLine2; } void Student::setCity(string City) { myCity = City; } void Student::setState(string State) { myState = State; } void Student::setZipcode(int Zipcode) { myZipcode = Zipcode; } void Student::setOther(string Other) { myOther = Other; } //these are accessor operations of the Student class, they only return a student's particular data field string Student::getName() const { return myName; } string Student::getPhoneNumber() const { return myPhoneNumber; } string Student::getEmail() const { return myEmail; } string Student::getAddressLine1() const { return myAddressLine1; } string Student::getAddressLine2() const { return myAddressLine2; } string Student::getCity() const { return myCity; } string Student::getState() const { return myState; } int Student::getZipcode() const { return myZipcode; } string Student::getOther() const { return myOther; } //this is the overloaded assignment operator =, which when sent a student copies that student's info into the current student's info (is this mimicking the copy constructor??) Student& Student::operator=(const Student& student) { if(this != &student) { myName = student.myName; myPhoneNumber = student.myPhoneNumber; myEmail = student.myEmail; myAddressLine1 = student.myAddressLine1; myAddressLine2 = student.myAddressLine2; myCity = student.myCity; myState = student.myState; myZipcode = student.myZipcode; myOther = student.myOther; } return *this; }