Skip to content

Commit

Permalink
Merge pull request #15 from yeekian/master
Browse files Browse the repository at this point in the history
Add and Delete Students from StudentList
  • Loading branch information
RCPilot1604 authored Oct 9, 2024
2 parents a79b148 + da1eb6a commit 45dd0bd
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/main/java/Student.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
public class Student {
private String matricNumber;
private double GPA;

public Student(String matricNumber) {
this.matricNumber = matricNumber;
this.GPA = 0.0;
}

public String getMatricNumber() {
return matricNumber;
}

public double getGPA() {
return GPA;
}

public void setMatricNumber(String matricNumber) {
this.matricNumber = matricNumber;
}

public void setGPA(double GPA) {
this.GPA = GPA;
}
}
20 changes: 20 additions & 0 deletions src/main/java/StudentList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import java.util.ArrayList;
import java.util.Arrays;

public class StudentList {
private Integer numberOfStudents;
private Student[] studentList = new Student[0];
ArrayList<Student> studentArrayList = new ArrayList<>(Arrays.asList(studentList));

public StudentList() {
this.numberOfStudents = 0;
}

public void deleteStudent(Student student){
studentArrayList.remove(student);
}

public void addStudent(Student student){
studentArrayList.add(student);
}
}

0 comments on commit 45dd0bd

Please sign in to comment.