#include "student.h" #include using std::ofstream; using std::ifstream; student::student() : name(""), phone(""), email(""), street(""), aptnum(""), city(""), state(""), zip(0), other("") { } student::student( string aname, string aphone, string anemail, string astreet, string anaptnum, string acity, string astate, int azip, string another ) { name = aname; phone = aphone; email = anemail; street = astreet; aptnum = anaptnum; city = acity; state = astate; zip = azip; other = another; } string student::getname( ) const { return name; } string student::getphone( ) const { return phone; } string student::getemail( ) const { return email; } string student::getstreet( ) const { return street; } string student::getaptnum( ) const { return aptnum; } string student::getcity( ) const { return city; } string student::getstate( ) const { return state; } int student::getzip( ) const { return zip; } string student::getother( ) const { return other; } void student::print( ofstream& out ) const { if(name != "") out << "Name:\n " << name << "\n"; if(phone != "") out << "Phone Number:\n " << phone << "\n"; if(email != "") out << "Email:\n " << email << "\n"; if( street != "" || aptnum != "" || city != "" || state != "" || zip != 0) { out << "Address:\n "; if(street != "") out << street << "\n "; if(aptnum != "") out << aptnum << "\n "; if(city != "") { out << city; if(state == "" && zip == 0) out << "\n"; else out << ", "; } if(state != "") { out << state; if(zip != 0) { out << " "; if(zip/10000 == 0) out << "0"; out << zip << "\n"; } if(zip == 0) out << "\n"; } else if (zip != 0) { if(zip/10000 == 0) out << "0"; out << zip << "\n"; } if(other != "") out << "Other:\n" << other << "\n"; } }