#include "Header.h" #include "Organizer.h" // student class functions //////////////////////////////////////////////////////////////// // this functions sets the default values of the variables // Parameters: none // // Returns: nothin // // Called by: class student // Calls: Student::Student() { string bnk = "blank"; // default value name = bnk; phone= bnk; email = bnk; address1 = bnk; address2 = bnk; city = bnk; state = bnk; zip =bnk; other=bnk; } // updates the value of name void Student::update_name( string name1 ) { name = name1; } // updates the value of phone void Student::update_phone( string phone1 ) { phone = phone1; } // updates the value of email void Student::update_email( string email1 ) { email = email1; } // updates the value address1 void Student::update_address1( string address1a ) { address1 = address1a; } // updates the value of address2 void Student::update_address2( string address2a ) { address2 = address2a; } // updates the value of city void Student::update_city( string city1 ) { city = city1; } // updates the value of state void Student::update_state( string state1 ) { state = state1; } // updates the value of zip void Student::update_zip( string zip1 ) { zip = zip1; } //updates the value of other void Student::update_other( string other1 ) { other = other1; } // returns the value of name string Student::access_name(Student std) { string temp; temp = std.name; return temp; } // returns the value of phone string Student::access_phone(Student std) { string temp; temp = std.phone; return temp; } // returns the value of email string Student::access_email( Student std ) { string temp; temp = std.email; return temp; } // returns the value of address1 string Student::access_address1(Student std) { string temp; temp = std.address1; return temp; } // returns the value of address2 string Student::access_address2(Student std) { string temp; temp = std.address2; return temp; } // returns the value of city string Student::access_city(Student std) { string temp; temp = std.city; return temp; } // returns the value of state string Student::access_state(Student std) { string temp; temp = std.state; return temp; } // returns the value of zip string Student::access_zip(Student std) { string temp; temp = std.zip; return temp; } // returns the value of other string Student::access_other(Student std) { string temp; temp = std.other; return temp; } // multimedia class functions //////////////////////////////////////////////////////////////// // // // // // // // this function accepts data from the student file and creates new student // objects. it then stores those object into array for safe keeping // // Parameters: none // // Returns: void // // Called by: main // Calls: update_array void Organizer::update_array() { int i=0, x=0; // variable declaration string temp; string old; string name1; string test1; string bnk = "blank"; // default string Student test; // student type test // *cant remember wat exactly this is for Student std; // student type std ifstream infile("students.data"); // opens an input file while( !infile.eof() && x < 100 ) // while not equal to end of file { // and while in the bounds of the array getline( infile, temp, '\n' ); // get command std.update_name(bnk); // set to default values std.update_phone(bnk); std.update_email( bnk ); std.update_address1(bnk); std.update_address2(bnk); std.update_city(bnk); std.update_state(bnk); std.update_zip( bnk); std.update_other(bnk); while( temp != "@@" ) // while not = to @@ { // search through the data if( temp == "@Name:" ) // updates the student object w/ data { getline( infile, name1, '\n' ); std.update_name( name1 ); } else if( temp == "@Phone Number:") { getline( infile, name1, '\n' ); std.update_phone( name1 ); } else if( temp == "@E-mail:" ) { getline( infile, name1, '\n' ); std.update_email( name1 ); } else if(temp == "@Address Line 1:") { getline( infile, name1, '\n' ); std.update_address1( name1 ); } else if(temp == "@Address Line 2:") { getline( infile, name1, '\n' ); std.update_address2( name1 ); } else if(temp == "@City:") { getline( infile, name1, '\n' ); std.update_city( name1 ); } else if(temp == "@State:") { getline( infile, name1, '\n' ); std.update_state( name1 ); } else if(temp == "@Zipcode:") { getline( infile, name1, '\n' ); std.update_zip( name1 ); } else if(temp == "@Other:") { getline( infile, name1, '\n' ); std.update_other( name1 ); } else { break; } getline( infile, temp, '\n' ); // get next command } getline( infile, temp, '\n' ); // gets white space array[i] = std; // stores teh student object in the array i++; // increment i x++; // increments x count++; // increments # objexts in the array } /*test = org.array[2]; test1 = test.city; if( test1 == "blank" ) cout << "Null\n"; else cout << test1 << endl; */ } //////////////////////////////////////////////////////////////// // 100 ) return false; while( m < 100 ) // while less then 100 { // search through the array tink = array[m]; // gets object str = tink.access_email(tink); // gets email address if( str == bnk ) // if the email address is set to default { array[m] = std; // add the item to that possision add++; // increments students added if( deleted == add ) // if students added = students deleted then no count++; // free spots so adds to the end of array increment return true; // # of student objects } m++; // increment m } return false; // otherwise if not added return false } //////////////////////////////////////////////////////////////// // 100 ) // if there is not room in the array left return false; // return false //array1[count1+1] = multi; //return true; while( m < 100 ) // adds multimedia object to available { // slots in the array tink = array1[m]; str = tink.access_owner(tink); if( str == bnk ) { array1[m] = multi; add1++; if( deleted1 == add ) count1++; return true; } m++; // increment m } return false; // return false } //////////////////////////////////////////////////////////////// //