Question: A java question. Write a class StudentManager which uses a Map to associate students's names and their letter grades. Both the keys (names) and the
A java question. Write a class StudentManager which uses a Map to associate students's names and their letter grades. Both the keys (names) and the values (letter grades) are Strings.
The constructor initializes an empty map.
public StudentManager()
Provide methods:
1. public void add(String name, String grade) adds the student name and grade to the map
2. public void remove(String name) removes the association of this name and gpa
3. public int getClassSize() gets the number of students in the class
4. public String getPrintableRoster() gets the names of the students in alphabetical order and their grades in the format below
Anisa: A Carlos: B+ James: A-
------------------------------------------------------------------------------------------
The StudentManagerRunner is given as follow:
StudentManagerRunner.java
public class StudentManagerRunner { public static void main(String[] args) { StudentManager students = new StudentManager(); students.add("Anisa", "A"); students.add("Carlos", "B+"); students.add("James", "A-"); System.out.println(students.getPrintableRoster()); } } Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
