// Project 2 for CS 1704 Spring 2004 // // Programmer: Kristen Mitchell // OS: Windows XP Professional // System: Dell Pentium IV, 2.6 Ghz, 512 MB RAM // Compiler: Microsoft Visual C++ // Last modified: Feb. 2004 // // Purpose // This program is designed to store information about a student // [Name, Address, City, State, Zip, Email, and Other] as well as the // multimedia items that the student owns. Multimedia items // [Name, Type, Price, Location, Etc] are stored in an array. The // ManageMultimedia class interacts between the Student and Multimedia // classes. // // The program then writes to file the commands called as well as how // successful the command call was (Success/ Failure). // #include #include #include #include #include "ManageMultimedia.h" #include "Student.h" #include "Multimedia.h" using namespace std; int main () { ManageMultimedia multiOrganizer; //constructs a mulitmedia item ifstream CommandsFile; //opens the commands.data file CommandsFile.open ("commands.data"); string FileWord(""); // a blank word to hold a file while (CommandsFile>>FileWord) //While not EOF { //STRINGS TO HOLD THE VALUES READ IN FROM THE FILES, THEY ARE ALL INITALIZED TO "" string email(""), sname(""), sphone(""), semail(""), sadd1(""), sadd2(""), scity(""), sstate(""), szip(""), sinfo(""); string iitem(""), itype(""), iby(""), iemail(""), iprice(""), iloc(""), junk (""); if (FileWord== "delete") { CommandsFile>>email; multiOrganizer.Delete(email); //Calls delete function } if (FileWord == "add") { CommandsFile>>FileWord; if (FileWord=="student") { while (FileWord != "@@") { CommandsFile>>FileWord; //cout<>FileWord; getline (CommandsFile, junk); getline (CommandsFile, sphone); } if (FileWord== "@E-mail:") { getline (CommandsFile, junk); getline (CommandsFile, semail); } if (FileWord== "@Address") { CommandsFile>>FileWord; CommandsFile>>FileWord; if (FileWord== "1:") { getline (CommandsFile, junk); getline (CommandsFile, sadd1); } if (FileWord== "2:") { getline (CommandsFile, junk); getline (CommandsFile, sadd2); } } if (FileWord=="@City:") { getline (CommandsFile, junk); getline (CommandsFile, scity); } if (FileWord=="@State:") { getline (CommandsFile, junk); getline (CommandsFile, sstate); } if (FileWord=="@Zipcode:") { getline (CommandsFile, junk); getline (CommandsFile, szip); } if (FileWord== "@Other:") { getline (CommandsFile, junk); getline (CommandsFile, sinfo); } } //Create and instance of the Student class using the 9 para constructor Student Temp (sname, sphone, semail, sadd1, sadd2, scity, sstate, szip, sinfo); //cout<<"Add Student: "<>FileWord; if (FileWord=="@Item:") { getline (CommandsFile, junk); getline (CommandsFile, iitem); } if (FileWord=="@Media") { CommandsFile>>FileWord; getline (CommandsFile, junk); getline (CommandsFile, itype); } if (FileWord=="@by:") { getline (CommandsFile, junk); getline (CommandsFile, iby); } if (FileWord=="@Owner:") { getline (CommandsFile, junk); getline (CommandsFile, iemail); } if (FileWord=="@Price:") { getline (CommandsFile, junk); getline (CommandsFile, iprice); } if (FileWord=="@Availability:") { getline (CommandsFile, junk); getline (CommandsFile, iloc); } } //Declare an instance of the Multimedia class using 6 para constructor Multimedia Temp2 (iitem, itype, iby, iemail, iprice, iloc); //cout<<"Add multimedia Item: "<>tempWord; if (tempWord== "students") multiOrganizer.PrintStudents(); //Calls the printstudents function if (tempWord== "items") multiOrganizer.PrintItems(); //Calls the print function else if ((tempWord != "items") && (tempWord != "students")) multiOrganizer.Print(tempWord); //Calls the print function } if (FileWord=="quit") //Calls the quit function multiOrganizer.Quit(); } //end top while loop return 0; } /* On my honor: - I have not discussed the C++ language code in my program with anyone other than my instructor of the teaching assistants assigned to this course. - I have not used the C++ language code obtained from another student, or any other unauthorized source, either modified or unmodified. - If any C++ language code or documentation used in my program was obtained from another source, such as a textbook or course notes, that has been clearly noted with proper citation in the comments of my program. - I have notdesigned this program in such a way as to defeat or interfere with the normal operation of the Curator System. Kristen Mitchell kmtchll */