Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/jpa-buddy.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions hd.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Binary file added out/production/hd/College.class
Binary file not shown.
Binary file added out/production/hd/Main.class
Binary file not shown.
Binary file added out/production/hd/Student.class
Binary file not shown.
Binary file added out/production/hd/Teacher.class
Binary file not shown.
16 changes: 8 additions & 8 deletions src/Main.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import java.util.ArrayList;
public class Main {
public static void main(String[] args){
public static void main(String[] args) {
//create Student objects
Student student1=new Student("demeke",1,new int[]{85,90,95});
Student student2=new Student("beletu",2,new int[]{87,89,99});
Student student1 = new Student("demeke", 1, new int[]{85, 90, 95});
Student student2 = new Student("beletu", 2, new int[]{87, 89, 99});
//create Teacher objects
Teacher teacher1=new Teacher("abeje","physics");
Teacher teacher2=new Teacher("tigist","biology");
Teacher teacher1 = new Teacher("abeje", "physics");
Teacher teacher2 = new Teacher("tigist", "biology");
//create College objects
College college1=new College("Informatics",new ArrayList<Student>(),new ArrayList<Teacher>());
College college1 = new College("Informatics", new ArrayList<Student>(), new ArrayList<Teacher>());
// Add Student and Teacher objects to the college
college1.getStudents().add(student1);
college1.getStudents().add(student2);
college1.getTeachers().add(teacher1);
college1.getTeachers().add(teacher2);
//print out details
System.out.println("College Name: " + College.getName());
System.out.println("College Name: " + College.getName());
System.out.println("Students:");
for (Student s : College.getStudents()) {
System.out.println("Name: " + s.getName());
Expand All @@ -29,6 +29,6 @@ public static void main(String[] args){
System.out.println("Subject: " + t.getSubject());
System.out.println();
}

}
}

19 changes: 12 additions & 7 deletions src/Student.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,38 @@ public class Student {
private String name;
private int id;
private int[] grades;

//constructor
public Student(String name,int id,int[] grades){
this.name=name;
this.id=id;
this.grades=grades;
public Student(String name, int id, int[] grades) {
this.name = name;
this.id = id;
this.grades = grades;
}
//getter and setter for students attribute

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public int[] getGrades() {
return grades;
}
public void setGrades(int[] grades){
this.grades=grades;
}

public void setGrades(int[] grades) {
this.grades = grades;
}
}


2 changes: 1 addition & 1 deletion src/Teacher.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public Teacher(String name, String subject) {
this.subject = subject;
}

getter and setter for teacher attribute
//getter and setter for teacher attribute
public String getName() {
return name;
}
Expand Down