#include #include #include #include #include "student.h" using namespace std; Student::Student() { //initializes data member's values to default values string Name = ""; string Phone = ""; string Address1 = ""; string Address2 = ""; string City = ""; string State = ""; int Zip = 0; string Email = ""; string Other = ""; } int Student::Print(ofstream & Out) { //prints out all of the data members as per the project specs. if (Name != "")Out << "Name:" << endl << " " << Name << endl; if (Phone != "")Out << "Phone Number:" << endl << " " << Phone << endl; Out << "Email:" << endl << " " << Email << endl; if (Address1 != "" || Address2 != "" || City != "" || State != "" || Zip > 0) { Out << "Address:" << endl; if(Address1 != "")Out << " " << Address1 << endl; if(Address2 != "")Out << " " << Address2 << endl; //the following conditionals are just for proper formatting of the city/state/zip code line. if (City != "" || State != "" || Zip > 0) { if (City != "" && State != "") { Out << " " << City << ", " << State; } else{ if(City != "" && Zip > 0) Out << " " << City << "," ; if(City != "" && Zip < 1) Out << " " << City; if(State != "") Out << " " << State; } if (Zip > 0 && Zip > 9999)Out << " " << Zip; if (Zip > 0 && Zip < 10000 && Zip > 999)Out << " 0" << Zip; if (Zip > 0 && Zip < 1000 && Zip > 99)Out << " 00" << Zip; if (Zip > 0 && Zip < 100 && Zip > 9)Out << " 000" << Zip; if (Zip > 0 && Zip < 10)Out << " 0000" << Zip; Out << endl; } } if(Other != "")Out << "Other:" << endl << " " << Other << endl; return 1; } int Student::Delete() { //this function resets the data members to default values so that it can be recognised as a blank entry in the array in the container class. Name = ""; Phone = ""; Address1 = ""; Address2 = ""; City = ""; State = ""; Zip = 0; Email = ""; Other = ""; return 1; } //the rest are just simple mutators or accessors. string Student::getName() { return Name; } int Student::setName(string Input) { Name = Input; return 1; } string Student::getPhone() { return Phone; } int Student::setPhone(string Input) { Phone = Input; return 1; } string Student::getAdd1() { return Address1; } int Student::setAdd1(string Input) { Address1 = Input; return 1; } string Student::getAdd2() { return Address2; } int Student::setAdd2(string Input) { Address2 = Input; return 1; } string Student::getCity() { return City; } int Student::setCity(string Input) { City = Input; return 1; } string Student::getState() { return State; } int Student::setState(string Input) { State = Input; return 1; } int Student::getZip() { return Zip; } int Student::setZip(int Input) { if (Input > 0 && Input < 100000) { Zip = Input; return 1; } return 0; } string Student::getEmail() { return Email; } int Student::setEmail(string Input) { Email = Input; return 1; } string Student::getOther() { return Other; } int Student::setOther(string Input) { Other = Input; return 1; }