static void testCohortStats(cohortStats testCohort, int cohortYear) { studentStats testStudent = generateStudent(); double oldBurden = 0; double newBurden = 0; Console.WriteLine("Data has already been preloaded. Testing if empty: "); if (testCohort.empty()) { Console.WriteLine("True"); } else { Console.WriteLine("False"); } Console.WriteLine("Test for most burden: " + testCohort.findMostBurden()); Console.WriteLine("Test for least burden: " + testCohort.findLeastBurden()); Console.WriteLine("Test for numDeactive: " + testCohort.numDeactive()); oldBurden = testCohort.totalLoans(); Console.WriteLine("Test for total Burden: " + oldBurden); Console.WriteLine("Test for adding student: "); while (testStudent.checkMatriculation(cohortYear) == false) { testStudent = generateStudent(); } newBurden = testCohort.totalLoans(); if (newBurden > oldBurden) { Console.WriteLine("The loan total has increased, meaning add was successful."); } else { Console.WriteLine("The loan total has not increased, meaning add was unsuccessful."); } }
//preconditions: grad year must match the cohort's //postconditions: new student added, cohort list may be full public bool addStudent(studentStats newStudent) { if (newStudent.checkMatriculation(matriculation)) { if (currentStudent == students.Length) { Array.Resize(ref students, students.Length + moreSlots); } students[currentStudent] = newStudent; currentStudent++; return(true); } else { return(false); } }