020-001-011

Student Grade List Management

Medium

Problem Description

Student Grade List Management

In this problem: You will create a program that uses ArrayList<Integer> to manage student grades, including adding grades, calculating the average, finding max/min values, and removing failing grades (below 40).

Learning Objective: Understand basic ArrayList operations (add, traverse, remove) and safe element removal using an iterator

Overview

Store student grades (integer values) in an ArrayList<Integer> and perform various operations. Implement grade addition, statistical calculations, and conditional element removal.

Specifications

Main Class (Main.java)

  1. Create an ArrayList<Integer> and add the following grades: 85, 92, 38, 76, 45, 30, 88, 67, 55, 41
  2. Display all grades (format: "Grades: [85, 92, 38, 76, 45, 30, 88, 67, 55, 41]")
  3. Display the grade count (format: "Count: 10")
  4. Calculate and display the average (format: "Average: 61.7", 1 decimal place)
  5. Display the maximum and minimum grades (format: "Max: 92", "Min: 30")
  6. Remove failing grades (below 40)
  7. Display grades after removal (format: "After removing failing grades: [85, 92, 76, 45, 88, 67, 55, 41]")

Note: Use an Iterator for removing failing grades to prevent ConcurrentModificationException.

Output Format

Grades: [85, 92, 38, 76, 45, 30, 88, 67, 55, 41]
Count: 10
Average: 61.7
Max: 92
Min: 30
After removing failing grades: [85, 92, 76, 45, 88, 67, 55, 41]

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up