Page 1 of 1

Write a Java program to create a Hashmap for various courses in an University with two fields namely, - CourseCode / Co

Posted: Mon May 09, 2022 7:14 am
by answerhappygod
Write a Java program to create a Hashmap for various courses in
an University with two fields namely,
- CourseCode / Course ID (which is the key field, this field
is unique) and
- Number of students enrolled under each Coursecode / Course
ID.
Every entry in this HashMap will have a pair of CourseCode and
the corresponding number of students enrolled under this
course.
Insert the (CourseCode, NumberofStudents) fields for every
entry.
To insert the values into a HashMap either you can use Scanner
class to get user input or you can insert the values directly into
the HashMap.Insert two or three entries into the HashMap and print
the contents of the HashMap.