Ok one last problem... i hope.
When i run through my Undergrad loop and add the grades it works. but when i add two or more Undergrad students it uses the most recent scores added for all the Undergrad students. I realize i need to do some sort of loop so that i can add more arrays. I can have a maximum of 20 students. in my array. How would i make an array that has a different name every time 1 is added. here is my code.
Code:class Undergrad extends College { int[] tempAct, tempExercise, tempProject; int ap, ex1, ex2, fEx; public UnderGrad(String name, int age, String schoolName, int id, double gpa, int apCreds, String major, String minor, boolean time, int examOne, int examTwo, int[] activity, int[] exercise, int[] projects, int finalExam) { super(name, age, id, schoolName, gpa, major, minor, time); tempAct = activity; tempExercise = exercise; tempProject = projects; ap = apCreds; ex1 = examOne; ex2 = examTwo; fEx = finalExam; } public String toString() { String A, E, P; A = ""; for(int i = 0; i < 14; i++) A += tempAct[i] + " "; E = ""; for(int j = 0; j < 14; j++) E += tempExercise[j] + " "; P = ""; for (int k = 0; k < 14; k++) P += tempProject[k] + " "; String temp = super.toString(); return temp +"\nExam One Grade: "+ex1+ "\nExam Two Grade: "+ex2+"\nActivity Grades: "+A+"\nExercise Grades: "+E+"\nProject Grades: "+P; } }



Reply With Quote
Bookmarks