Question: Java Help- please include comments. Create a class Section that contains the following information: String department (e.g., CSC) int courseNumber (e.g., 151) int sectonNumber (e.g.,
Java Help- please include comments.
Create a class Section that contains the following information:
String department (e.g., "CSC")
int courseNumber (e.g., 151)
int sectonNumber (e.g., 4101)
String instructor (e.g., "Sophie")
String title (e.g., "Introduction to Java")
Use Section objects as the key for a HashMap in the attached Register class. Sophie, Sally and Jack should all be in the same section. Everyone else should be in different sections. We should be able to test with different data sets as well.
Register Class:
import java.util.ArrayList; import java.util.HashMap;
public class Register {
public static void main(String[] args) { HashMap
}
Correct output will look something like this, depending on Section's toString:
[sophie, sally, jack] in Section [dept=CSC, courseNum=151, section=1, instructor=Sophie Charlotte, title=Intro to Java]
[freckles] in Section [dept=DBA, courseNum=151, section=1, instructor=Sophie Charlotte, title=SQL 1]
[lassie] in Section [dept=CSC, courseNum=151, section=2, instructor=Sophie C, title=Introduction to Java]
[zipper] in Section [dept=CSC, courseNum=251, section=1, instructor=Sophie Charlotte, title=Adv Java]
Invalid output will look something like this:
[sophie] in Section [dept=CSC, courseNum=151, section=1, instructor=Sophie Charlotte, title=Intro to Java]
[lassie] in Section [dept=CSC, courseNum=151, section=2, instructor=Sophie C, title=Introduction to Java]
[freckles] in Section [dept=DBA, courseNum=151, section=1, instructor=Sophie Charlotte, title=SQL 1]
[jack] in Section [dept=CSC, courseNum=151, section=1, instructor=S Charlotte, title=Java Introduction]
[sally] in Section [dept=CSC, courseNum=151, section=1, instructor=S Charlotta, title=Introduction to Java]
[zipper] in Section [dept=CSC, courseNum=251, section=1, instructor=Sophie Charlotte, title=Adv Java]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
