#include "Person.h" #include "Student.h" #include "courseInfo.h" #include "340.h" int main() { int choice = 0; Student NIU_Student; //creates a student object while (choice != 999) { cout << "\nStudent Registration Database" << endl; cout << "Please choose from the options below (type 999 to quit)\n" << endl; cout << "0. Select this to read in from file" << endl; cout << "1. Enter new student information" << endl; cout << "2. Enter new class information for student" << endl; cout << "3. Edit student information (not valid)" << endl; cout << "4. Edit class information for student (not valid)" << endl; cout << "5. Print student information\n" << endl; cout << "Please enter your choice: (the press enter, 999 to quit)"; cin >> choice; switch(choice) { case 0: { ifstream inFile; inFile.open("C:\\Documents and Settings\\Tony\\My Documents\\Visual Studio 2008\\Projects\\proj2\\file.txt"); //opens file if (!inFile) { cout << "\nThe input file does not exist!" << endl; return 1; } string value, courseID, year, semester, grade; NIU_Student.setFirstName(value); inFile >> value; NIU_Student.setLastName(value); inFile >> value; NIU_Student.setSSN(value); inFile >> value; NIU_Student.setDOB(value); inFile >> value; NIU_Student.setGender(value); inFile >> value; NIU_Student.setZID(value); inFile >> courseID; while (inFile) { inFile >> year >> semester >> grade; CourseInfo student; student.setCourseID(courseID); student.setYearTaken(year); student.setSemesterTaken(semester); student.setGrade(grade); //addCourse(student); inFile >> courseID; } /* while (inFile) { //read in class info (courseName, courseYear, courseSemester, courseGrade) // be able to read in as many as needed - and add them to the linked list set up in Student.h } read a courseID while (inFile) { read the rest of the values for a course create a CourseInfo object using the values you've read (doesn't need to be dynamically allocated) call addCourse() to add the CourseInfo object to the linked list read the next courseID } Does that make sense? The addCourse() method should call addToHead(), passing along the CourseInfo object. */ break; } case 1: { string x; cout << "Please enter the first name: "; cin >> x; NIU_Student.setFirstName(x); cout << "Please enter the last name: "; cin >> x; NIU_Student.setLastName(x); cout << "Please enter students social security number: "; cin >> x; NIU_Student.setSSN(x); cout << "Please enter student DoB: "; cin >> x; NIU_Student.setDOB(x); cout << "Please enter the student's gender: "; cin >> x; NIU_Student.setGender(x); cout << "Please enter students ZID: "; cin >> x; NIU_Student.setZID(x); break; } case 2: { //string entry, // more; /* do { cout << "Please enter course name: "; cin >> entry; NIU_Student.courses[NIU_Student.getCount()].setCourseID(entry); cout << "Please enter year taken: "; cin >> entry; NIU_Student.courses[NIU_Student.getCount()].setYearTaken(entry); cout << "Please enter semester taken: "; cin >> entry; NIU_Student.courses[NIU_Student.getCount()].setSemesterTaken(entry); cout << "Please enter grade for course: "; cin >> entry; NIU_Student.courses[NIU_Student.getCount()].setGrade(entry); cout << "Enter another class? (Y/N): "; cin >> more; NIU_Student.incrementCount(); } while (more == "Y" || more == "y"); */ break; } case 3: { cout << "Choice entered was 3" << endl; break; } case 4: { cout << "Choice entered was 4" << endl; break; } case 5: { NIU_Student.infoPrint(); break; } case 999: { cout << "Quitting..." << endl; break; } } // end of switch statement } // end of while return 0; }