Create a treemap of course names each map entry should


Java Maps and Lists

Part 1: Students and Courses
(1) Create a Student class, with ID, last name, and a list of courses.

(2) Create a Course class, with name (such as COP2220), credits, and semester ID (0 to 3). In this class, create a static list of course names. Also, create a static array of 4 semester names, such as "Fall 2012", and "Spring 2014". In each Course object, the semester ID is an index into the array of semester names.

(3) Create a test program that does the following:
Fill a list with 10 students. Each student should be assigned 10 courses, involving at least 2 semesters.

Part 2: Students and Courses
(Java Maps and Lists) You created the Students and Courses application (Part 1) Now you are asked to improved it in the following ways:

(1) Create a TreeMap of course names. Each map entry should contain a single integer that counts the number of students who have enrolled in that course.

(2) Display the map in ascending order by course name, showing each course name and its enrollment count.

Note: You cannot directly increment the enrollment count in a map entry. Instead, retrieve the existing count using the get() method, add 1 to the count, and then insert the key and updated enrollment count back into the map by calling the put() method.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Create a treemap of course names each map entry should
Reference No:- TGS02382638

Now Priced at $10 (50% Discount)

Recommended (96%)

Rated (4.8/5)