#include "student.h" /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::Student() // // Preconditions: None // // Postconditions: Student has been intialized and name, phone, email, streetaddy, aptnumber, // city, state, zipcode, and other have the default value of "none" // // Parameters: // None // Student::Student() { name="none"; phone="none"; email="none"; streetaddy="none"; aptnumber="none"; city="none"; state="none"; zipcode="none"; other="none"; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::SetName(string cityin) // // Preconditions: namein must be valid // // Postconditions: name will take on the value passed through from the parameter // // Parameters: // namein The string of which name is going to be equal to // void Student::SetName(string namein) { name=namein; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::SetPhone(string phonein) // // Preconditions: phonein must be valid // // Postconditions: phone will take on the value passed through from the parameter // // Parameters: // phonein The string of which phone is going to be equal to // void Student::SetPhone(string phonein) { phone=phonein; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::SetEmail(string emailin) // // Preconditions: emailin must be valid // // Postconditions: email will take on the value passed through from the parameter // // Parameters: // emailin The string of which email is going to be equal to // void Student::SetEmail(string emailin) { email=emailin; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::SetStreetAddress(string streetaddyin) // // Preconditions: streetaddyin must be valid // // Postconditions: streetaddy will take on the value passed through from the parameter // // Parameters: // streetaddyin The string of which streetaddy is going to be equal to // void Student::SetStreetAddress(string streetaddyin) { streetaddy=streetaddyin; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::SetAptNumber(string aptnumberin) // // Preconditions: aptnumberin must be valid // // Postconditions: aptnumber will take on the value passed through from the parameter // // Parameters: // aptnumberin The string of which aptnumber is going to be equal to // void Student::SetAptNumber(string aptnumberin) { aptnumber=aptnumberin; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::SetCity(string cityin) // // Preconditions: cityin must be valid // // Postconditions: city will take on the value passed through from the parameter // // Parameters: // cityin The string of which city is going to be equal to // void Student::SetCity(string cityin) { city=cityin; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::SetState(string statein) // // Preconditions: statein must be valid // // Postconditions: state will take on the value passed through from the parameter // // Parameters: // statein The string of which state is going to be equal to // void Student::SetState(string statein) { state=statein; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::SetZipCode(string zipcodein) // // Preconditions: zipcodein must be valid // // Postconditions: zipcode will take on the value passed through from the parameter // // Parameters: // zipcodein The string of which zipcode is going to be equal to // void Student::SetZipCode(string zipcodein) { zipcode=zipcodein; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::SetOther(string otherin) // // Preconditions: otherin must be valid // // Postconditions: other will take on the value passed through from the parameter // // Parameters: // otherin The string of which other is going to be equal to // void Student::SetOther(string otherin) { other=otherin; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::GetName() const // // Preconditions: Student must be intialized // // Postconditions: returns the name string // // Parameters: // (none) // string Student::GetName() const { return name; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::GetPhone() const // // Preconditions: Student must be intialized // // Postconditions: returns the phone string // // Parameters: // (none) // string Student::GetPhone() const { return phone; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::GetEmail() const // // Preconditions: Student must be intialized // // Postconditions: returns the email string // // Parameters: // (none) // string Student::GetEmail() const { return email; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::GetStreetAddress() const // // Preconditions: Student must be intialized // // Postconditions: returns the streetaddy string // // Parameters: // (none) // string Student::GetStreetAddress() const { return streetaddy; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::GetAptnumber() const // // Preconditions: Student must be intialized // // Postconditions: returns the aptnumber string // // Parameters: // (none) // string Student::GetAptnumber() const { return aptnumber; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::GetCity() const // // Preconditions: Student must be intialized // // Postconditions: returns the city string // // Parameters: // (none) // string Student::GetCity() const { return city; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::GetState() const // // Preconditions: Student must be intialized // // Postconditions: returns the state string // // Parameters: // (none) // string Student::GetState() const { return state; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::GetZipCode() const // // Preconditions: Student must be intialized // // Postconditions: returns the zipcode string // // Parameters: // (none) // string Student::GetZipCode() const { return zipcode; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::GetOther() const // // Preconditions: Student must be intialized // // Postconditions: returns the other string // // Parameters: // (none) // string Student::GetOther() const { return other; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::PrintStudent(ostream& outFile) const // // Preconditions: email must not be empty // // Postconditions: The student information will be ostreamed into outFile // // Parameters: // outFile Used to output the student information to the user // void Student::PrintStudent(ostream& outFile) const { if(email == "none") { cout << "EMPTY" << endl; return; } else { if(name != "none") outFile << "Name: \n " << name << endl; if(phone != "none") outFile << "Phone Number: \n " << phone << endl; outFile << "Email: \n " << email << endl; if(streetaddy != "none" || aptnumber != "none" || city != "none" || state != "none" || zipcode != "none") outFile << "Address:" << endl; if(streetaddy != "none") outFile << ' ' << streetaddy << endl; if(aptnumber != "none") outFile << ' ' << aptnumber << endl; if(city != "none" || state != "none" || zipcode != "none") outFile << ' '; if(city != "none" && (state != "none" || zipcode != "none")) outFile << city << ", "; if(city != "none" && state == "none" && zipcode == "none") outFile << city << endl; if(state != "none") outFile << state << ' '; if(zipcode != "none") outFile << zipcode << endl; if(state != "none" && zipcode == "none") outFile << endl; if(other != "none") outFile << "Other: \n " << other << "\n"; outFile << endl; } } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Student::isEmpty() const // // Preconditions: none // // Postconditions: returns true if email contains the default values or false if not // // Parameters: // (none) // bool Student::isEmpty() const { if(email == "none") return true; else return false; }