Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Java 8 HashMap Suppose we are implementing a customized HashMap for recording course information. This class is designed for different courses and it record

Use Java 8image text in transcribedimage text in transcribed

HashMap Suppose we are implementing a customized HashMap for recording course information. This class is designed for different courses and it record pairs of Key and Value. The key will be the studentName and the value will be the mark that student scored for this course. Let's assume that each student has unique names. You need to implement the following methods: - StudentMarkHashMap (Constructor) - toString - addStudentWithMark - hasStudent - hasMark Example output for toString method: HashMap for course CSC207: Daniel scored: 88 Jack scored: 90 import java.util.HashMap; public class StudentMarkHashMap { // TODO: declare your variables * TODO: Implement a constructor that takes a course code and course number * and initializes the HashMap. * @param courseCode the course code. e.g. CSC * @param courseNumber the course number. e.g. 207 ** * TODO: Implement the toString according to the example output shown above. * @return formatted String representation of this class's instance @Override public String toString() { /** * TODO: Define a addStudentWithMark method that tries to add a student mark information to the HashMap, * and returns a boolean value to nidicate whether it was successfully added. * @param studentName the student name to be added * @param mark the mark that student scored * @return true if the student information was recorded successfully. If the student already exist in the HashMap, then return false. * TODO: Define a hasStudent method that tells if the HashMap contains a specific student. * @param studentName the student name to check for * @return true if the student is in the HashMap otherwise false */ * TODO: Define a hasMark method that return whether the course has a student who scored a given mark. * @param mark the mark to check for * @return true if the mark exists otherwise false

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

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions

Question

How flying airoplane?

Answered: 1 week ago

Question

b. Did you suppress any of your anger? Explain.

Answered: 1 week ago