I want to create an array of the object student, and be able to add a student, delete a student and change the student attributes. Please help. I need to add and do all these things using an interactive user input (Scanner).
here's the student class i created.
public class student
{
private String name;
private int age;
private char grade;
// constructor
public student(String nameIn, int ageIn, char gradeIn)
{
name = nameIn;
age = ageIn;
grade = gradeIn;
}
// Methods
// Getter Methods
public String getName()
{
return name;
}
public int getAge()
{
return age;
}
public char getGrade()
{
return grade;
}
// Setter methods
public void setName(String nameIn)
{
name = nameIn;
}
public void setAge(int ageIn)
{
age = ageIn;
}
public void setGrade(char gradeIn)
{
grade = gradeIn;
}
// to String
public String toString()
{
return "Student " + getName() + " aged " + getAge() + " has grade: " + getGrade();
}
}