Initial commit
This commit is contained in:
41
src/Student/Course.java
Normal file
41
src/Student/Course.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package Student;
|
||||
|
||||
public class Course {
|
||||
private String title;
|
||||
private int Students;
|
||||
private final int maxStudents = 10;
|
||||
Student[] students = new Student[10];
|
||||
int count = 0;
|
||||
|
||||
public String Register(Student student) {
|
||||
if (count < 10) {
|
||||
students[count] = student;
|
||||
count++;
|
||||
return "Success";
|
||||
} else {
|
||||
return "Course full!";
|
||||
}
|
||||
|
||||
}
|
||||
public boolean isFull()
|
||||
{
|
||||
if(count ==9)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public int NumberofStudents()
|
||||
{
|
||||
if(students[0].getName().isBlank())
|
||||
return 0;
|
||||
else
|
||||
return count;
|
||||
|
||||
}
|
||||
public String title()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
}
|
||||
30
src/Student/Student.java
Normal file
30
src/Student/Student.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package Student;
|
||||
|
||||
public class Student
|
||||
{
|
||||
private String name;
|
||||
private String id;
|
||||
|
||||
Student(String n, String Id)
|
||||
{
|
||||
this.name=n;
|
||||
this.id=Id;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void Register(Course course)
|
||||
{
|
||||
//To be done later
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user