Created
December 17, 2010 10:37
-
-
Save valo/744760 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
public class School { | |
private List<SchoolClass> m_classes = new ArrayList<SchoolClass>(); | |
private List<SchoolRoom> m_rooms = new ArrayList<SchoolRoom>(); | |
public School() { | |
} | |
public void addSchoolClass(SchoolClass schoolClass) { | |
m_classes.add(schoolClass); | |
} | |
public void addSchoolRoom(SchoolRoom room) { | |
m_rooms.add(room); | |
} | |
public List<SchoolClass> getSchoolClasses() { | |
return m_classes; | |
} | |
public List<SchoolRoom> getSchoolRooms() { | |
return m_rooms; | |
} | |
public void print() { | |
System.out.println("School info:"); | |
System.out.println(" Classes:"); | |
for (SchoolClass schoolClass : m_classes) { | |
schoolClass.print(); | |
} | |
System.out.println(" Rooms:"); | |
for (SchoolRoom schoolRoom : m_rooms) { | |
schoolRoom.print(); | |
} | |
} | |
} |
Hehe. Just an example for a friend for his programming homework ;-)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh, nice. Hungarian notation. Haven't seen that in a while :)