Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java expert please help me the program below? Here is the requirement. ===== Register.java ==== import java.util.ArrayList; import java.util.HashMap; public class Register { public static

Java expert please help me the program below? Here is the requirement.

image text in transcribed

=====Register.java====

import java.util.ArrayList; import java.util.HashMap;

public class Register {

public static void main(String[] args) { HashMap> roster = new HashMap(); Section s1 = new Section("CSC", 151, 0001, "Bob Charlotte", "Intro to Java"); Section s2 = new Section("CSC", 151, 0001, "Bob C", "Introduction to Java"); Section s3 = new Section("CSC", 151, 0001, "B Charlotte", "Java Introduction"); Section s4 = new Section("CSC", 151, 0002, "Bob C", "Introduction to Java"); Section s5 = new Section("DBA", 151, 0001, "Bob Charlotte", "SQL 1"); Section s6 = new Section("CSC", 251, 0001, "Bob Charlotte", "Adv Java"); registerAStudent(roster, s1, "bob"); registerAStudent(roster, s2, "mike"); registerAStudent(roster, s3, "delco"); registerAStudent(roster, s4, "lassie"); registerAStudent(roster, s5, "freckles"); registerAStudent(roster, s6, "zipper"); System.out.println(roster); } public static void registerAStudent(HashMap> roll, Section s, String student) { ArrayList victims = roll.get(s); if (victims == null) { victims = new ArrayList(); victims.add(student); } else { victims.add(student); } roll.put(s, victims); }

}

Create a Section that contains met int sectonWun instructor (e.g., Bal use Section obieck as the egister ake an section. Everyone eke skou SAouyed all be uv the same

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Donald A. Carpenter Fred R. McFadden

1st Edition

8178088045, 978-8178088044

Students also viewed these Databases questions