#include "Student.h" #include #include using namespace std; //////////////////////////////////////////////////////////////// DEFAULT CONSTRUCTOR // Default Student Constructor // // Parameters: None // Pre: // Post: All variables are initalized // // Returns: None // // Called by: Anyone using the Student class may call this function // Calls: None Student::Student () { myName=""; myPhone=""; myEmail=""; myStreetAdd=""; myAppartment=""; myCity=""; myState=""; myZip=""; myInfo=""; } //////////////////////////////////////////////////////////////// NINE PARAMETER CONSTRUCTOR // The 9 parameter Student Constructor // // Parameters: string name, string phone, string email, string streetAdd, string appt, string city, string state, string zip, sting other // Pre: // Post: All variables are initalized // // Returns: None // // Called by: Anyone using the Student class may call this function // Calls: None Student::Student (string name, string phone, string email, string streetAdd, string appt, string city, string state, string zip, string other) { myName=name; myPhone=phone; myEmail=email; myStreetAdd=streetAdd; myAppartment=appt; myCity=city; myState=state; myZip=zip; myInfo=other; } //////////////////////////////////////////////////////////////// Destructor // The student destructor // // Parameters: // Pre: An object of the class has been created // Post: All variables are destructed // // Returns: None // // Called by: Anyone using the Student class may call this destructor // Calls: None Student ::~Student () { } //////////////////////////////////////////////////////////////// Name () const // Returns the myName variable // // Parameters: None // Pre: The constructor has been called and variables initalized. // Post: The myName variable has been returned. // // Returns: string myName // // Called by: Anyone using the Student class may call this function // Calls: None string Student::Name () const { return myName; } //////////////////////////////////////////////////////////////// Phone () const // Returns the myPhone variable // // Parameters: None // Pre: The constructor has been called and variables initalized. // Post: The myPhone variable has been returned. // // Returns: string myPhone // // Called by: Anyone using the Student class may call this function // Calls: None string Student::Phone () const { return myPhone; } //////////////////////////////////////////////////////////////// Email () const // Returns the myEmail variable // // Parameters: None // Pre: The constructor has been called and variables initalized. // Post: The myEmail variable has been returned. // // Returns: string myEmail // // Called by: Anyone using the Student class may call this function // Calls: None string Student::Email () const { return myEmail; } //////////////////////////////////////////////////////////////// StreetAdd () const // Returns the myStreetAdd variable // // Parameters: None // Pre: The constructor has been called and variables initalized. // Post: The myStreetAdd variable has been returned. // // Returns: string myStreetAdd // // Called by: Anyone using the Student class may call this function // Calls: None string Student::StreetAdd () const { return myStreetAdd; } //////////////////////////////////////////////////////////////// Appartment () const // Returns the myAppartment variable // // Parameters: None // Pre: The constructor has been called and variables initalized. // Post: The myAppartment variable has been returned. // // Returns: string myAppartment // // Called by: Anyone using the Student class may call this function // Calls: None string Student::Appartment () const { return myAppartment; } //////////////////////////////////////////////////////////////// City () const // Returns the myCity variable // // Parameters: None // Pre: The constructor has been called and variables initalized. // Post: The myCity variable has been returned. // // Returns: string myCity // // Called by: Anyone using the Student class may call this function // Calls: None string Student::City () const { return myCity; } //////////////////////////////////////////////////////////////// State () const // Returns the myState variable // // Parameters: None // Pre: The constructor has been called and variables initalized. // Post: The myState variable has been returned. // // Returns: string myState // // Called by: Anyone using the Student class may call this function // Calls: None string Student::State () const { return myState; } //////////////////////////////////////////////////////////////// Zip () const // Returns the myZip variable // // Parameters: None // Pre: The constructor has been called and variables initalized. // Post: The myZip variable has been returned. // // Returns: string myZip // // Called by: Anyone using the Student class may call this function // Calls: None string Student::Zip () const { return myZip; } //////////////////////////////////////////////////////////////// OtherInfo () const // Returns the myInfo variable // // Parameters: None // Pre: The constructor has been called and variables initalized. // Post: The myInfo variable has been returned. // // Returns: string myInfo // // Called by: Anyone using the Student class may call this function // Calls: None string Student::OtherInfo () const { return myInfo; } //////////////////////////////////////////////////////////////// ChangeName // Changes the value of myName to user defined input // // Parameters: string newName // Pre: The constructor has been called // Post: The value of the private variable has been changed // // Returns: None // // Called by: Anyone using the Student class may call this function // Calls: None void Student::ChangeName (string newName) { myName=newName; } //////////////////////////////////////////////////////////////// ChangePhone // Changes the value of myPhone to user defined input // // Parameters: string newPhone // Pre: The constructor has been called // Post: The value of the private variable has been changed // // Returns: None // // Called by: Anyone using the Student class may call this function // Calls: None void Student::ChangePhone (string newPhone) { myPhone=newPhone; } //////////////////////////////////////////////////////////////// ChangeEmail // Changes the value of myEmail to user defined input // // Parameters: string newEmail // Pre: The constructor has been called // Post: The value of the private variable has been changed // // Returns: None // // Called by: Anyone using the Student class may call this function // Calls: None void Student::ChangeEmail (string email) { myEmail=email; } //////////////////////////////////////////////////////////////// ChangeSAddress // Changes the value of myStreetAdd to user defined input // // Parameters: string street // Pre: The constructor has been called // Post: The value of the private variable has been changed // // Returns: None // // Called by: Anyone using the Student class may call this function // Calls: None void Student::ChangeSAddress (string street) { myStreetAdd=street; } //////////////////////////////////////////////////////////////// ChangeAppartment // Changes the value of myAppartment to user defined input // // Parameters: string appt // Pre: The constructor has been called // Post: The value of the private variable has been changed // // Returns: None // // Called by: Anyone using the Student class may call this function // Calls: None void Student::ChangeAppartment (string appt) { myAppartment=appt; } //////////////////////////////////////////////////////////////// ChangeCity // Changes the value of myCity to user defined input // // Parameters: string cty // Pre: The constructor has been called // Post: The value of the private variable has been changed // // Returns: None // // Called by: Anyone using the Student class may call this function // Calls: None void Student::ChangeCity (string cty) { myCity=cty; } //////////////////////////////////////////////////////////////// ChangeState // Changes the value of myState to user defined input // // Parameters: string state // Pre: The constructor has been called // Post: The value of the private variable has been changed // // Returns: None // // Called by: Anyone using the Student class may call this function // Calls: None void Student::ChangeState (string state) { myState= state; } //////////////////////////////////////////////////////////////// ChangeZip // Changes the value of myZip to user defined input // // Parameters: string zipCode // Pre: The constructor has been called // Post: The value of the private variable has been changed // // Returns: None // // Called by: Anyone using the Student class may call this function // Calls: None void Student::ChangeZip (string zipCode) { myZip=zipCode; } //////////////////////////////////////////////////////////////// ChangeInfo // Changes the value of myInfo to user defined input // // Parameters: string info // Pre: The constructor has been called // Post: The value of the private variable has been changed // // Returns: None // // Called by: Anyone using the Student class may call this function // Calls: None void Student::ChangeInfo (string info) { myInfo=info; } //////////////////////////////////////////////////////////////// Operator << // Overloads the << operator for use with the Student Class // // Parameters: ostream out, Student stu // Pre: The constructor has been called // Post: The student sent has been output to the ostream // // Returns: an ostream object // // Called by: Anyone using the Student class may call this function // Calls: None ostream & operator << (ostream & out, const Student & stu) { if (stu.Email()=="") return out; if (stu.Name()!="") out<<"Name:"<