Commit b11720b9 authored by MostafaRahmati's avatar MostafaRahmati

last question is not solved yet

parent 4aaca3fb
......@@ -29,6 +29,7 @@ public class College {
facultyLabs=new Lab[labCount];
Student sampleStudent = new Student("Foo", "Bar", "99xxxxxx");
for (int i = 0; i < facultyLabs.length; i++) {
facultyLabs[i] = new Lab(5, "dAy oF cLaSs");
facultyLabs[i].enrollStudent(sampleStudent);
}
}
......@@ -39,8 +40,15 @@ public class College {
*/
public void print(int i){
if(i>facultyLabs.length)
System.out.println("Faculty Has Not That Lab Class");
else
facultyLabs[i-1].print();
System.out.println("Faculty Has Not Lab Class No."+i);
else{
try {
facultyLabs[i-1].print();
}
catch (Exception e){
System.out.println("");
}
}
}
}
......@@ -54,8 +54,10 @@ public class Lab {
*/
public void print() {
for (int i = 0; i < students.length; i++) {
System.out.println("FirstName: " + students[i].getFirstName() + "\tLastName: " + students[i].getLastName() +
"\t\tID:" + students[i].getId() + "\t\tGrade:" + students[i].getGrade());
if (students[i]!=null){
System.out.println("FirstName: " + students[i].getFirstName() + "\tLastName: " + students[i].getLastName() +
"\t\tID:" + students[i].getId() + "\t\tGrade:" + students[i].getGrade());
}
}
calculateAvg();
System.out.println("AVERAGE GRADE: " + getAvg());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment