From the course: Java Essential Training: Objects and APIs

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Code Solution: Gradebook

Code Solution: Gradebook

(upbeat music) - [Instructor] Your task for this challenge was to evaluate two maps of test scores, gradebook, and makeupGrades, and return a single map which contains the best of the two scores for each student. Let's start by looping over the original map of grades, which is gradebook, and say, for each entry in this map, we'll call the key student and the value originalGrade. Then we use that key to get the value of the new test score for that student from the makeupGrades map, and we store that value into the makeupGrade variable. Now, we can compare the new makeup grade with the original grade, and if the makeup grade is better, we'll update the gradebook map by using the put method to replace the student's old grade with the new one.

Contents