I'm making a list of strings in a TreeMap to keep track of grades for a bunch of students. Right now my program is printing the list of strings like this:
Jimmy: C+
Tim: A
Samantha: B-
Mike: A-
When I want it to print out like this:
Jimmy: C+
Tim: A
Samantha: B-
Mike: A-
How do I get the names and grades to be spaced like this? Here's the section of my code that prints out everything:
//Print all students with their grades
case "P": System.out.println();
for(Map.Entry<String, String> entry : grades.entrySet())
{
System.out.println(entry.getKey() + ": " + entry.getValue());
}
System.out.println();
break;