static void Main() { Console.Write("Generating an array of studentStat objects with capacity of "); Console.Write(TEST_MAX); Console.Write(": "); Console.WriteLine(); studentStat[] studentCollection = new studentStat[TEST_MAX]; int count = 0; foreach(studentStat element in studentCollection) { studentCollection[count] = new studentStat(); ++count; } Console.Write("studentStat array of length "); Console.Write(studentCollection.Length); Console.Write("."); Console.WriteLine(); studentStatSetup(ref studentCollection); testTotalBurden(ref studentCollection); testIndexMost(ref studentCollection); Console.ReadKey(); }
public static void makePayments(studentStat student) { for (int i = 0; i < (randNum.Next(0, (student.numDegrees + 1))); i++) { int amount = randNum.Next(1000, 100001); student.makePayment(i, amount); } }
static void studentStatSetup(ref studentStat[] studentCollection) { int count = 0; foreach (studentStat element in studentCollection) { Console.WriteLine(); Console.Write("STUDENT "); Console.Write(count + 1); Console.WriteLine(); Console.Write("Please enter a student ID: "); int testID = new int(); testID = randomNum(ID_MIN, ID_MAX); Console.Write(testID); Console.WriteLine(); Console.WriteLine(); for (int index = 0; index < TEST_DEBTS; ++index) { Console.Write("****Debt Stat #"); Console.Write(index + 1); Console.Write("****"); Console.WriteLine(); Console.Write("Enter loan amount: $"); int testLoan = new int(); testLoan = randomNum(MONEY_MIN, MONEY_MAX); Console.Write(testLoan); Console.WriteLine(); Console.Write("Enter grant amount: $"); int testGrant = new int(); testGrant = randomNum(MONEY_MIN, MONEY_MAX); Console.Write(testGrant); Console.WriteLine(); Console.Write("Enter matriculation date (YYYYMMDD): "); int testMatric = new int(); testMatric = randomNum(MIN_DATE, MAX_DATE); Console.Write(testMatric); Console.WriteLine(); Console.Write("Enter graduation date (YYYYMMDD): "); int testGrad = new int(); testGrad = randomNum(MIN_DATE, MAX_DATE); Console.Write(testGrad); Console.WriteLine(); studentCollection[index].constructStats(testID, testLoan, testGrant, testMatric, testGrad); } ++count; } Console.WriteLine(); }
static void testIndexMost(ref studentStat[] studentCollection) { int count = 0; foreach (studentStat element in studentCollection) { Console.Write("Which degree carries the most debt for student #"); Console.Write(count); Console.Write(": "); Console.Write("Debt Stat #"); Console.Write(studentCollection[count].indexMostBurden() + 1); Console.WriteLine(); ++count; } }
static void testTotalBurden(ref studentStat[] studentCollection) { int count = 0; foreach (studentStat element in studentCollection) { int totalBurden = new int(); totalBurden = studentCollection[count].totalBurden(); Console.Write("Total Debt Burden for Student #"); Console.Write(count + 1); Console.Write(" is : $"); Console.Write(totalBurden); Console.WriteLine(); ++count; } }
static void Main(string[] args) { const int numStudents = 5; studentStat[] studentArray = new studentStat[numStudents]; generateStudents(studentArray); printStudentInfo(studentArray); studentStat initialStudent = studentArray[0]; cohortStat group = new cohortStat(initialStudent); generateCohort(studentArray, group); printCohort(group); }
// Precondition: The client is responsible for apssing ina valid studentStat object. // Postcondition List will have more than one studentStat object. public void addStudent(studentStat student) { students.Add(student); }
// Preconditions: The client must pass a valid studentStat object to construct a cohortStat. // Postconditions: CohortStat object in valid initial state. List contains 1 student. public cohortStat(studentStat initialStudent) { students = new List <studentStat>(); students.Add(initialStudent); }