// Section.cpp // This file has the definitions for the Section class methods. #include #include "Section.h" // This constructor does the reading of the input. It also does an // insertion sort as it reads the input instead of doing a separate sort // after everything has been read. Section::Section() { string first,last; numStudents=0; for(cin >> first; first!="quit"; cin >> first) { cin >> last; int i; for(i=numStudents-1; (i>=0) && (student[i].getLast()+student[i].getFirst()=8) { cout << "You can't add more assignments.\n"; return; } cout << "Enter the assignment grades for the class (" << numStudents << " students).\n"; for(int i=0; i> grade; student[i].addAssn(grade); } } void Section::addQuiz() { if(student[0].getNumQuizzes()>=6) { cout << "You can't add more quizzes.\n"; return; } cout << "Enter the quiz grades for the class (" << numStudents << " students).\n"; for(int i=0; i> grade; student[i].addQuiz(grade); } } void Section::addTest() { if(student[0].getNumTests()>=2) { cout << "You can't add more tests.\n"; return; } cout << "Enter the test grades for the class (" << numStudents << " students).\n"; for(int i=0; i> grade; student[i].addTest(grade); } } void Section::changeParticip() { string last,first; cout << "Enter a first and last name for the student whose class participation should\n be changed: "; cin >> first >> last; int which=searchForName(first,last); if(which<0) { cout << "Student not found in class.\n"; return; } cout << "Input new participation grade. "; double part; cin >> part; student[which].setParticip(part); } void Section::display() { for(int i=0; i> first >> last; int which=searchForName(first,last); if(which<0) { cout << "Student not found in class.\n"; return; } student[which].print(); } int Section::searchForName(string first,string last) { for(int i=0; i