The assignment requires that I write a program to update, maintain and query students' records on an ongoing basis. It requires a few things, but there's one in specific that I'm stuck on.
This is my Student class:
public class Student {
private String id, firstname, lastname;
Student(String i, String f, String l) {
id = i;
firstname = f;
lastname = l;
}
String getid() {
return id;
}
String getfirstname() {
return firstname;
}
String getlastname() {
return lastname;
}
}
This is my Admissions class:
import java.util.ArrayList;
public class Admissions {
Student s;
ArrayList<Student> list;
int index;
boolean found;
//2a
Admissions() {
list = new ArrayList<Student>();
}
//2b
void add(Student s) {
list.add(s);
}
//2c
int size() {
return list.size();
}
//2d
boolean isempty() {
return list.isEmpty();
}
//2e
void search(String key) {
if (list.s.getid().equalsIgnoreCase()) {
;
}
//Prof. didn't tell us how to do this. We need to figure it out, but I think it's with a while loop.
}
//2f
Student remove(int i) {
return list.remove(i);
}
}
My problem is under 2e. I need to "given an id number, locate that record on the list"
Thanks!