P
psmith
I am using BlueJ and trying to create a HashMap to hold students names
and grade results.
I have been told that one variable called students, should hold a map
of students using their names as keys. The student objects which are
the values of this map are to represent the students in the the tutor
group.
So far I declared the variables - not sure if I have done this
correctly:
private String students;
private char results;
Firstly should the String student should be an array?
I have my constructor:
public TutorGroup()
{
Map<String, Student> tutorGroup=new HashMap<String, Student>();
}
My problem starts here:
public void addStudent(String name)
{
tutorGroup.put(Student, name); // error I get here is cannot
find variable tutorGroup.
}
I have to use the above to add a Students name to the student object.
I have put various bits of code into the method above, but just
constantly get error messages.
Can anybody please help me with what I should be doing above, or point
my in a direction to try and read and understand where I am going
wrong.
Thanks in advance.
and grade results.
I have been told that one variable called students, should hold a map
of students using their names as keys. The student objects which are
the values of this map are to represent the students in the the tutor
group.
So far I declared the variables - not sure if I have done this
correctly:
private String students;
private char results;
Firstly should the String student should be an array?
I have my constructor:
public TutorGroup()
{
Map<String, Student> tutorGroup=new HashMap<String, Student>();
}
My problem starts here:
public void addStudent(String name)
{
tutorGroup.put(Student, name); // error I get here is cannot
find variable tutorGroup.
}
I have to use the above to add a Students name to the student object.
I have put various bits of code into the method above, but just
constantly get error messages.
Can anybody please help me with what I should be doing above, or point
my in a direction to try and read and understand where I am going
wrong.
Thanks in advance.