// 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 27, 2004 // // Purpose // The purpose of this file is to describe the implementation for the data type // organizer, in other words, it contains the implementation for all the previously // declared member functions of the Organizer class. Since an organizer holds // arrays of students and items, this file contains the interfaces for those data // types as well. #include "students.h" #include "items.h" #include "organizer.h" #include #include #include using std::string; // This is the constructor for the organizer class. It is called by main, and begins // by opening the students data fiel and reading in the information. It does this // until the file has ended, and sets the rest of the students data to default values // as well. It then opens up the items data file and does the same thing. Organizer::Organizer() { ifstream inStudentFile; inStudentFile.open("students.data"); //open the students data file assert( inStudentFile.is_open() ); //check with an assert int index = 0; int ref = 0; int n, p, a1, a2, c, s, z, o; //these will check to see which (if any) if statemets were entered, or in other words, which fields exist for this particular student char line[500]; string input; while( inStudentFile ) //go through the students.data file and read in and fill in the array with the information { n = 0; p = 0; a1 = 0; a2 = 0; c = 0; s = 0; z = 0; o = 0; inStudentFile.getline(line,256,'\n'); input=line; while(input != "@@") //read in the information { if(input == "@Name:") { string Name; inStudentFile.getline(line,256,'\n'); Name=line; students[index].setName(Name); n++; } else if(input == "@Phone Number:") { string PhoneNumber; inStudentFile.getline(line,256,'\n'); PhoneNumber=line; students[index].setPhoneNumber(PhoneNumber); p++; } else if(input == "@E-mail:") { string Email; inStudentFile.getline(line,256,'\n'); Email=line; students[index].setEmail(Email); } else if(input == "@Address Line 1:") { string AddressLine1; inStudentFile.getline(line,256,'\n'); AddressLine1=line; students[index].setAddressLine1(AddressLine1); a1++; } else if(input == "@Address Line 2:") { string AddressLine2; inStudentFile.getline(line,256,'\n'); AddressLine2=line; students[index].setAddressLine2(AddressLine2); a2++; } else if(input == "@City:") { string City; inStudentFile.getline(line,256,'\n'); City=line; students[index].setCity(City); c++; } else if(input == "@State:") { string State; inStudentFile.getline(line,256,'\n'); State=line; students[index].setState(State); s++; } else if(input == "@Zipcode:") { string Temp; int Zipcode; inStudentFile.getline(line,256,'\n'); Temp=line; istringstream ss(Temp); ss >>Zipcode; students[index].setZipcode(Zipcode); z++; } else if(input == "@Other:") { string Other; inStudentFile.getline(line,256,'\n'); Other=line; students[index].setOther(Other); o++; } else { break; } inStudentFile.getline(line,256,'\n'); input=line; } //if certain fields weren't read in, then set those fields to deafult values for this student if(n == 0) { students[index].setName("nothing"); } if(p == 0) { students[index].setPhoneNumber("nothing"); } if(a1 == 0) { students[index].setAddressLine1("nothing"); } if(a2 == 0) { students[index].setAddressLine2("nothing"); } if(c == 0) { students[index].setCity("nothing"); } if(s == 0) { students[index].setState("nothing"); } if(z == 0) { students[index].setZipcode(0); } if(o == 0) { students[index].setOther("nothing"); } index++; getline(inStudentFile, input); } inStudentFile.close(); //close the students data file // at this point, because the organizer class contains an array of students, it has called // the default constructor for the rest of the students already. ifstream inItemFile; inItemFile.open("items.data"); //open the items data file assert( inItemFile.is_open() ); //check with an assert int i, m, b, pri, a; //these are like the checker integers above for the students file string read; while( inItemFile ) //go through the items.data file and read in and fill in the array with the given information { i = 0; m = 0; b = 0; pri = 0; a = 0; getline(inItemFile, read); while(read != "@@") { if(read == "@Item:") { string Title; getline(inItemFile, Title); items[ref].setItem(Title); i++; } else if(read == "@Media Type:") { string MediaType; getline(inItemFile, MediaType); items[ref].setMediaType(MediaType); m++; } else if(read == "@by:") { string by; getline(inItemFile, by); items[ref].setBy(by); b++; } else if(read == "@Owner:") { string Owner; getline(inItemFile, Owner); items[ref].setOwner(Owner); } else if(read == "@Price:") { inItemFile.ignore(1, '$'); double Price; inItemFile>>Price; getline(inItemFile, read); items[ref].setPrice(Price); pri++; } else if(read == "@Availability:") { string Availability; getline(inItemFile, Availability); items[ref].setAvailability(Availability); a++; } else { break; } getline(inItemFile, read); } //if any of the checker values didn't get incremented, set those data fields to default values if(i == 0) { items[ref].setItem("nothing"); } if(m == 0) { items[ref].setMediaType("nothing"); } if(b == 0) { items[ref].setBy("nothing"); } if(pri == 0) { items[ref].setPrice(0.0); } if(a == 0) { items[ref].setAvailability("nothing"); } ref++; getline(inItemFile, read); } inItemFile.close(); //clsoe the items data file } //////////////////////////////////////////////////////////////// // This function checks to see if the student's read in email address // isn't a default values, and if not adds the student to the students array // in the first empty spot and prints Success to the output file; otherwise, // prints Failure // // Parameters: // a student to add into the students array, and the file to print to // // Pre: the constructor of the Student class has been called to send // in the student, the output file is open // // Post: if the sent in student's email isn't a default, and there's // an empty space in the array, the sent in student has been // added here. // // Returns: nothing // // Called by: main // Calls: accessor functions of the Student class, as well as the overloaded // assignement operator = for the Student class void Organizer::AddStudent(Student student, ofstream &outCommandFile) { if(student.getEmail() == "nothing") { outCommandFile<< "Failure" << endl; } else { int done = 0; //will see if the for loop ever finds an enpty position for(int u = 0; u < 100; u++) { if(done == 0) //if a student hasn't alrady been added during this loop, check for defualt values { if(students[u].getName() == "nothing") { if(students[u].getPhoneNumber() == "nothing") { if(students[u].getEmail() == "nothing") { if(students[u].getAddressLine1() == "nothing") { if(students[u].getAddressLine2() == "nothing") { if(students[u].getCity() == "nothing") { if(students[u].getState() == "nothing") { if(students[u].getZipcode() == 0) { if(students[u].getOther() == "nothing") { students[u] = student; //assign the student done++; //increment done outCommandFile<< "Success" << endl; //print out if this happened } } } } } } } } } } } } } //////////////////////////////////////////////////////////////// // This function checks to see a student with the item's owner // already exists, and if so, adds the item to the items array in the // first empty spot and prints Success to the output file; otherwise, // prints Failure // // Parameters: // a item to add to the items array and the file to print to // // Pre: the constructor of the Item class has been called to send // in the student, the output file is open // // Post: if the sent in student's email exists in the students array, // and there's an empty space in the items array, the sent in // item has been added here. // // Returns: nothing // // Called by: main // Calls: accessor functions of the Student and Item classes, as well as the overloaded // assignement operator = for the Item class void Organizer::AddItem(Item item, ofstream &outCommandFile) { bool bValidOwner=false; for(int u = 0; u < 100; u++) //check to see if there is a student that has the email of this item's owner { if(students[u].getEmail() == item.getOwner()) { bValidOwner=true; } } if(item.getOwner() == "nothing"||!bValidOwner) //if not { outCommandFile<< "Failure" << endl; } else { int complete = 0; //checker to see if the for loop ever finds an empty space in the array for(int o = 0; o < 100; o++) { if(complete == 0) //if an item hasn't already been added during this loop, then check for default values { if(items[o].getItem() == "nothing") { if(items[o].getMediaType() == "nothing") { if(items[o].getBy() == "nothing") { if(items[o].getOwner() == "nothing") { if(items[o].getPrice() == 0.0) { if(items[o].getAvailability() == "nothing") { items[o] = item; //assign sent item complete++; //increment complete outCommandFile<< "Success" << endl; //print out that this happened } } } } } } } } } } //////////////////////////////////////////////////////////////// // The delete function checks to see if any student has the sent in // email address or if any item's owner is the sent in email; if so, // sets that student/item's values to default values using the mutator // functions for the Student and Item classes, and prints out Success to // the output file; otherwise, prints out Failure // // Parameters: // an Email string to check, and the output file to print to // // Pre: the Email string has already been read in, the output file // is open // // Post: if a student (email) or item (owner) with the sent in // email address exists, that student/item has been deleted // from their spot in the array. // // Returns: nothing // // Called by: main // Calls: mutator functions of both the Student and Item classes void Organizer::Delete(string Email, ofstream &outCommandFile) { int checker = 0; //used to see if anything was found at all for(int y = 0; y < 100; y++) //if it matches, set the student to default values { if(students[y].getEmail() == Email) { students[y].setName("nothing"); students[y].setPhoneNumber("nothing"); students[y].setEmail("nothing"); students[y].setAddressLine1("nothing"); students[y].setAddressLine2("nothing"); students[y].setCity("nothing"); students[y].setState("nothing"); students[y].setZipcode(0); students[y].setOther("nothing"); checker++; } } for(int x = 0; x < 100; x++) { if(items[x].getOwner() == Email) //if it matches, set the item to default values { items[x].setItem("nothing"); items[x].setMediaType("nothing"); items[x].setBy("nothing"); items[x].setOwner("nothing"); items[x].setPrice(0.0); items[x].setAvailability("nothing"); checker++; } } if(checker !=0) //if you deleted anything, print Success { outCommandFile<< "Success" << endl; } else if(checker == 0) //otherwise, print Failure { outCommandFile<< "Failure" << endl; } } //////////////////////////////////////////////////////////////// // Goes through the array of students and prints out their information to the // output file in the appropriate way. // // Parameters: // the output file to print to // // Pre: the output file is open // // Post: any existing students (i.e. email doesn't equal a default value) // and all their information has been printed to the output file in // the appropriate way. // // Returns: nothing // // Called by: main // Calls: accessor functions of the Student class void Organizer::PrintStudents(ofstream &outCommandFile) { for(int s = 0; s < 100; s++) //go through the array of students and print out any field that isn't nothing if that student exists { if(students[s].getEmail()=="nothing") { continue; } if(students[s].getName() != "nothing") { outCommandFile<< "Name: " << endl; outCommandFile<<" " << students[s].getName() << endl; } if(students[s].getPhoneNumber() != "nothing") { outCommandFile<< "Phone Number: " << endl; outCommandFile<< " " << students[s].getPhoneNumber() << endl; } if(students[s].getEmail() != "nothing") { outCommandFile<< "Email: " << endl; outCommandFile<< " " << students[s].getEmail() << endl; } if(students[s].getAddressLine1() != "nothing") { if(students[s].getAddressLine2() != "nothing") { if(students[s].getCity() != "nothing") { if(students[s].getState() != "nothing") { if(students[s].getZipcode() != 0) { if(students[s].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << "0000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 10 && students[s].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << "000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 100 && students[s].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << "00" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 1000 && students[s].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << "0" << students[s].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << students[s].getZipcode() << endl; } } else if(students[s].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << endl; } } else if(students[s].getState() == "nothing") { if(students[s].getZipcode() != 0) { if(students[s].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << ", " << "0000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 10 && students[s].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() <<", " << "000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 100 && students[s].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() <<", " << "00" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 1000 && students[s].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() <<", " << "0" << students[s].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() <<", " << students[s].getZipcode() << endl; } } else if(students[s].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << endl; } } } else if(students[s].getCity() == "nothing") { if(students[s].getState() != "nothing") { if(students[s].getZipcode() != 0) { if(students[s].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getState() << " " << "0000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 10 && students[s].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getState() << " " << "000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 100 && students[s].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getState() << " " << "00" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 1000 && students[s].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getState() << " " << "0" << students[s].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getState() << " " << students[s].getZipcode() << endl; } } else if(students[s].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getState() << endl; } } else if(students[s].getState() == "nothing") { if(students[s].getZipcode() != 0) { if(students[s].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << "0000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 10 && students[s].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << "000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 100 && students[s].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << "00" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 1000 && students[s].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << "0" << students[s].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getZipcode() << endl; } } else if(students[s].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; } } } } else if(students[s].getAddressLine2() == "nothing") { if(students[s].getCity() != "nothing") { if(students[s].getState() != "nothing") { if(students[s].getZipcode() != 0) { if(students[s].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << "0000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 10 && students[s].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << "000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 100 && students[s].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << "00" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 1000 && students[s].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << "0" << students[s].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << students[s].getZipcode() << endl; } } else if(students[s].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << endl; } } else if(students[s].getState() == "nothing") { if(students[s].getZipcode() != 0) { if(students[s].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getCity() << ", " << "0000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 10 && students[s].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getCity() << ", " << "000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 100 && students[s].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getCity() << ", " << "00" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 1000 && students[s].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getCity() << ", " << "0" << students[s].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getZipcode() << endl; } } else if(students[s].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getCity() << endl; } } } else if(students[s].getCity() == "nothing") { if(students[s].getState() != "nothing") { if(students[s].getZipcode() != 0) { if(students[s].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getState() << " " << "0000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 10 && students[s].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getState() << " " << "000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 100 && students[s].getZipcode ()< 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getState() << " " << "00" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 1000 && students[s].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getState() << " " << "0" << students[s].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getState() << " " << students[s].getZipcode() << endl; } } else if(students[s].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getState() << endl; } } else if(students[s].getState() == "nothing") { if(students[s].getZipcode() != 0) { if(students[s].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << "0000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 10 && students[s].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << "000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 100 && students[s].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << "00" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 1000 && students[s].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << "0" << students[s].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; outCommandFile<< " " << students[s].getZipcode() << endl; } } else if(students[s].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine1() << endl; } } } } } if(students[s].getAddressLine1() == "nothing") { if(students[s].getAddressLine2() != "nothing") { if(students[s].getCity() != "nothing") { if(students[s].getState() != "nothing") { if(students[s].getZipcode() != 0) { if(students[s].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << "0000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 10 && students[s].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << "000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 100 && students[s].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << "00" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 1000 && students[s].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << "0" << students[s].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << students[s].getZipcode() << endl; } } else if(students[s].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << endl; } } else if(students[s].getState() == "nothing") { if(students[s].getZipcode() != 0) { if(students[s].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << ", " << "0000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 10 && students[s].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << ", " << "000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 100 && students[s].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << ", " << "00" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 1000 && students[s].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << ", " << "0" << students[s].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getZipcode() << endl; } } else if(students[s].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getCity() << endl; } } } else if(students[s].getCity() == "nothing") { if(students[s].getState() != "nothing") { if(students[s].getZipcode() != 0) { if(students[s].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getState() << " " << "0000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 10 && students[s].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getState() << " " << "000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 100 && students[s].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getState() << " " << "00" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 1000 && students[s].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getState() << " " << "0" << students[s].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getState() << " " << students[s].getZipcode() << endl; } } else if(students[s].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getState() << endl; } } else if(students[s].getState() == "nothing") { if(students[s].getZipcode() != 0) { if(students[s].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << "0000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 10 && students[s].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << "000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 100 && students[s].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << "00" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 1000 && students[s].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << "0" << students[s].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; outCommandFile<< " " << students[s].getZipcode() << endl; } } else if(students[s].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getAddressLine2() << endl; } } } } else if(students[s].getAddressLine2() == "nothing") { if(students[s].getCity() != "nothing") { if(students[s].getState() != "nothing") { if(students[s].getZipcode() != 0) { if(students[s].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << "0000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 10 && students[s].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << "000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 100 && students[s].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << "00" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 1000 && students[s].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << "0" << students[s].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << " " << students[s].getZipcode() << endl; } } else if(students[s].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getState() << endl; } } else if(students[s].getState() == "nothing") { if(students[s].getZipcode() != 0) { if(students[s].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getCity() << ", " << "0000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 10 && students[s].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getCity() << ", " << "000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 100 && students[s].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getCity() << ", " << "00" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 1000 && students[s].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getCity() << ", " << "0" << students[s].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getCity() << ", " << students[s].getZipcode() << endl; } } else if(students[s].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getCity() << endl; } } } else if(students[s].getCity() == "nothing") { if(students[s].getState() != "nothing") { if(students[s].getZipcode() != 0) { if(students[s].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getState() << " " << "0000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 10 && students[s].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getState() << " " << "000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 100 && students[s].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getState() << " " << "00" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 1000 && students[s].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getState() << " " << "0" << students[s].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getState() << " " << students[s].getZipcode() << endl; } } else if(students[s].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getState() << endl; } } else if(students[s].getState() == "nothing") { if(students[s].getZipcode() != 0) { if(students[s].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << "0000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 10 && students[s].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << "000" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 100 && students[s].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << "00" << students[s].getZipcode() << endl; } else if(students[s].getZipcode() >= 1000 && students[s].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << "0" << students[s].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[s].getZipcode() << endl; } } } } } } if(students[s].getOther() != "nothing") { outCommandFile<< "Other: " < // Goes through the array of items and prints out their information to the // output file in the appropriate way. // // Parameters: // the output file to print to // // Pre: the output file is open // // Post: any existing items (i.e. owner doesn't equal a default value) // and all their information has been printed to the output file in // the appropriate way. // // Returns: nothing // // Called by: main // Calls: accessor functions of the Item class void Organizer::PrintItems(ofstream &outCommandFile) { for(int i = 0; i < 100; i++) { if(items[i].getItem() != "nothing") //go through all the items in the array, and orint anything that isn't a default value { outCommandFile<< "Item: " << endl; outCommandFile<< " " << items[i].getItem() << endl; } if(items[i].getMediaType() != "nothing") { outCommandFile<< "Media Type: " << endl; outCommandFile<< " " << items[i].getMediaType() << endl; } if(items[i].getBy() != "nothing") { outCommandFile<< "by: " << endl; outCommandFile<< " " << items[i].getBy() << endl; } if(items[i].getOwner() != "nothing") { outCommandFile<< "Owner: " << endl; outCommandFile<< " " << items[i].getOwner() << endl; } if(items[i].getPrice() != 0.0) { outCommandFile<< "Price: " << endl; outCommandFile<< " " << "$" << setiosflags(ios::fixed)<< setprecision(2) << items[i].getPrice() << endl; } if(items[i].getAvailability() != "nothing") { outCommandFile<< "Availability: " << endl; outCommandFile<< " " << items[i].getAvailability() << endl; } outCommandFile << endl; } } //////////////////////////////////////////////////////////////// // Goes through the students array checking for the sent in Email, gets an // index value for the student is they exist, uses that to print out their // information. Then goes through the items array checking for any items // this student might own; if any are found, their information is printed // to the output file in the appropriate way. If a student isn't found in // the array, prints that the Email sent in was not found. // // Parameters: // an Email string to check, the output file to print to // // Pre: an Email string has been read, the output file is open // // Post: the student (if they exist) and all the items they own (if any) // have been printed to the output file in the appropriate way. // // Returns: nothing // // Called by: main // Calls: accessor functions of both the Student and Item classes void Organizer::PrintEmail(string Email, ofstream &outCommandFile) { int k = -1; //will be used to find index for(int p = 0; p < 100; p++) { if(students[p].getEmail() == Email) { k = p; //get the index of the student in the array if they exist } } if(k != -1) //if you found an index value, use it to print out the student's info { if(students[k].getName() != "nothing") { outCommandFile<< "Name: " << endl; outCommandFile<<" " << students[k].getName() << endl; } if(students[k].getPhoneNumber() != "nothing") { outCommandFile<< "Phone Number: " << endl; outCommandFile<< " " << students[k].getPhoneNumber() << endl; } if(students[k].getEmail() != "nothing") { outCommandFile<< "Email: " << endl; outCommandFile<< " " << students[k].getEmail() << endl; } if(students[k].getAddressLine1() != "nothing") { if(students[k].getAddressLine2() != "nothing") { if(students[k].getCity() != "nothing") { if(students[k].getState() != "nothing") { if(students[k].getZipcode() != 0) { if(students[k].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << "0000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 10 && students[k].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << "000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 100 && students[k].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << "00" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 1000 && students[k].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << "0" << students[k].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << students[k].getZipcode() << endl; } } else if(students[k].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << endl; } } else if(students[k].getState() == "nothing") { if(students[k].getZipcode() != 0) { if(students[k].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << "0000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 10 && students[k].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << "000" << students[k].getZipcode ()<< endl; } else if(students[k].getZipcode() >= 100 && students[k].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << "00" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 1000 && students[k].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << "0" << students[k].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getZipcode() << endl; } } else if(students[k].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << endl; } } } else if(students[k].getCity() == "nothing") { if(students[k].getState() != "nothing") { if(students[k].getZipcode() != 0) { if(students[k].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getState() << " " << "0000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 10 && students[k].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getState() << " " << "000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 100 && students[k].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getState() << " " << "00" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 1000 && students[k].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getState() << " " << "0" << students[k].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getState() << " " << students[k].getZipcode() << endl; } } else if(students[k].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getState() << endl; } } else if(students[k].getState() == "nothing") { if(students[k].getZipcode() != 0) { if(students[k].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << "0000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 10 && students[k].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << "000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 100 && students[k].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << "00" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 1000 && students[k].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << "0" << students[k].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getZipcode() << endl; } } else if(students[k].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; } } } } else if(students[k].getAddressLine2() == "nothing") { if(students[k].getCity() != "nothing") { if(students[k].getState() != "nothing") { if(students[k].getZipcode() != 0) { if(students[k].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << "0000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 10 && students[k].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << "000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 100 && students[k].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << "00" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 1000 && students[k].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << "0" << students[k].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << students[k].getZipcode() << endl; } } else if(students[k].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << endl; } } else if(students[k].getState() == "nothing") { if(students[k].getZipcode() != 0) { if(students[k].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getCity() << ", " << "0000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 10 && students[k].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getCity() << ", " << "000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 100 && students[k].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getCity() << ", " << "00" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 1000 && students[k].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getCity() << ", " << "0" << students[k].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getZipcode() << endl; } } else if(students[k].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getCity() << endl; } } } else if(students[k].getCity() == "nothing") { if(students[k].getState() != "nothing") { if(students[k].getZipcode() != 0) { if(students[k].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getState() << " " << "0000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 10 && students[k].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getState() << " " << "000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 100 && students[k].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getState() << " " << "00" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 1000 && students[k].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getState() << " " << "0" << students[k].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getState() << " " << students[k].getZipcode() << endl; } } else if(students[k].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getState() << endl; } } else if(students[k].getState() == "nothing") { if(students[k].getZipcode() != 0) { if(students[k].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << "0000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 10 && students[k].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << "000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 100 && students[k].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << "00" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 1000 && students[k].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << "0" << students[k].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; outCommandFile<< " " << students[k].getZipcode() << endl; } } else if(students[k].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine1() << endl; } } } } } if(students[k].getAddressLine1() == "nothing") { if(students[k].getAddressLine2() != "nothing") { if(students[k].getCity() != "nothing") { if(students[k].getState() != "nothing") { if(students[k].getZipcode() != 0) { if(students[k].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << "0000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 10 && students[k].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << "000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 100 && students[k].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << "00" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 1000 && students[k].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << "0" << students[k].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << students[k].getZipcode() << endl; } } else if(students[k].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << endl; } } else if(students[k].getState() == "nothing") { if(students[k].getZipcode() != 0) { if(students[k].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << "0000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 10 && students[k].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << "000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 100 && students[k].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << "00" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 1000 && students[k].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << "0" << students[k].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getZipcode() << endl; } } else if(students[k].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getCity() << endl; } } } else if(students[k].getCity() == "nothing") { if(students[k].getState() != "nothing") { if(students[k].getZipcode() != 0) { if(students[k].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getState() << " " << "0000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 10 && students[k].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getState() << " " << "000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 100 && students[k].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getState() << " " << "00" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 1000 && students[k].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getState() << " " << "0" << students[k].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getState() << " " << students[k].getZipcode() << endl; } } else if(students[k].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getState() << endl; } } else if(students[k].getState() == "nothing") { if(students[k].getZipcode() != 0) { if(students[k].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << "0000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 10 && students[k].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << "000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 100 && students[k].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << "00" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 1000 && students[k].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << "0" << students[k].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; outCommandFile<< " " << students[k].getZipcode() << endl; } } else if(students[k].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getAddressLine2() << endl; } } } } else if(students[k].getAddressLine2() == "nothing") { if(students[k].getCity() != "nothing") { if(students[k].getState() != "nothing") { if(students[k].getZipcode() != 0) { if(students[k].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << "0000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 10 && students[k].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << "000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 100 && students[k].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << "00" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 1000 && students[k].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << "0" << students[k].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << " " << students[k].getZipcode() << endl; } } else if(students[k].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getState() << endl; } } else if(students[k].getState() == "nothing") { if(students[k].getZipcode() != 0) { if(students[k].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getCity() << ", " << "0000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 10 && students[k].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getCity() << ", " << "000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 100 && students[k].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getCity() << ", " << "00" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 1000 && students[k].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getCity() << ", " << "0" << students[k].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getCity() << ", " << students[k].getZipcode() << endl; } } else if(students[k].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getCity() << endl; } } } else if(students[k].getCity() == "nothing") { if(students[k].getState() != "nothing") { if(students[k].getZipcode() != 0) { if(students[k].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getState() << " " << "0000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 10 && students[k].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getState() << " " << "000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 100 && students[k].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getState() << " " << "00" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 1000 && students[k].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getState() << " " << "0" << students[k].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getState() << " " << students[k].getZipcode() << endl; } } else if(students[k].getZipcode() == 0) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getState() << endl; } } else if(students[k].getState() == "nothing") { if(students[k].getZipcode() != 0) { if(students[k].getZipcode() < 10) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << "0000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 10 && students[k].getZipcode() < 100) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << "000" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 100 && students[k].getZipcode() < 1000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << "00" << students[k].getZipcode() << endl; } else if(students[k].getZipcode() >= 1000 && students[k].getZipcode() < 10000) { outCommandFile<< "Address: " << endl; outCommandFile<< " " << "0" << students[k].getZipcode() << endl; } else { outCommandFile<< "Address: " << endl; outCommandFile<< " " << students[k].getZipcode() << endl; } } } } } } if(students[k].getOther() != "nothing") { outCommandFile<< "Other: " <