Commit 4aaca3fb authored by MostafaRahmati's avatar MostafaRahmati

last question is not solved yet

parent fda8ae2b
/**
* The Lab class represents a College class with all of labClasses and
* referred information
*
* @author SpNova
* @version 0.0
*/
public class College {
// represents college name
private String name;
// represents count of lab classes in the faculty
private int labCount;
// represents the list of each faculty labs
private Lab[] facultyLabs;
/**
* @param name set name field of college
* @param labCount set lab count of the college
*/
public College(String name, int labCount){
this.name=name;
this.labCount=labCount;
}
/**
* initializes college class for test and debug purposes
*/
public void initialize(){
facultyLabs=new Lab[labCount];
Student sampleStudent = new Student("Foo", "Bar", "99xxxxxx");
for (int i = 0; i < facultyLabs.length; i++) {
facultyLabs[i].enrollStudent(sampleStudent);
}
}
/**
* pass lab number you want to print its details
* @param i set lab number
*/
public void print(int i){
if(i>facultyLabs.length)
System.out.println("Faculty Has Not That Lab Class");
else
facultyLabs[i-1].print();
}
}
...@@ -28,6 +28,11 @@ public class Run { ...@@ -28,6 +28,11 @@ public class Run {
//DEBUGGING Question //DEBUGGING Question
System.out.println("-------------------------------------------------------\n"); System.out.println("-------------------------------------------------------\n");
System.out.println("The Problem Is That Lab Average Is Not Calculated And Called Before Printing"); System.out.println("The Problem Is That Lab Average Is Not Calculated And Called Before Printing");
//College Class
College c1 = new College("Computer Engineering", 2);
c1.initialize();
c1.print(1);
c1.print(2);
c1.print(3);
} }
} }
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