Skip to content
Open

Main #37

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
2 changes: 2 additions & 0 deletions src/com/generation/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import com.generation.service.CourseService;
import com.generation.service.StudentService;
import com.generation.utils.PrinterHelper;
import com.generation.service.StudentService;


import java.text.ParseException;
import java.util.Scanner;
Expand Down
16 changes: 16 additions & 0 deletions src/com/generation/model/Student.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import java.util.List;
import java.util.Map;

//import java.text.Annotation;

public class Student
extends Person
implements Evaluation
Expand All @@ -24,6 +26,13 @@ public Student( String id, String name, String email, Date birthDate )
public void enrollToCourse( Course course )
{
//TODO implement this method
if(!isAttendingCourse(course.getCode())) {
courses.add(course);
}
else{
System.out.println("Student already enrolled in course.");
}

}

public void registerApprovedCourse( Course course )
Expand All @@ -34,7 +43,14 @@ public void registerApprovedCourse( Course course )

public boolean isAttendingCourse( String courseCode )
{


//TODO implement this method
for(Course c: courses){
if(c.getCode().equals(courseCode)) {
return true;
}
}
return false;
}

Expand Down
5 changes: 5 additions & 0 deletions src/com/generation/service/StudentService.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public Student findStudent( String studentId )

public void showSummary()
{
System.out.println("Students: ");
for(Student s: students.values()) {
// Student stud = students.get(key);
System.out.println(s.toString());
}
//TODO implement
}

Expand Down