CRJ101 Strayer week 5 Modern Day

  1. Create a class called Student with the following:
    • Private fields:
      • String name
      • int id
      • double[] grades (store 5 grades)
    • A constructor to initialize all fields.
    • Getter methods for name and id.
    • A method calculateAverage() that returns the average of the grades.
    • A method getHighestGrade() that returns the highest grade.
    • A method hasPassed() that returns true if the average is 60 or higher.
  2. In the main method:
    • Ask the user to enter:
      • Student name
      • Student ID
      • 5 grades
    • Create a Student object.
    • Display:
      • Student name and ID
      • Average grade
      • Highest grade
      • Whether the student passed or failed

Example Question Format (Specific Detail)

How do you properly encapsulate the grades array in the Student class to prevent external modification, while still allowing calculation of the average and highest grade?

This question focuses on:

  • Encapsulation
  • Arrays in objects
  • Access modifiers
  • Object-oriented design principles

If you’d like, I can also give you:

  • A debugging-type Java problem
  • An object-oriented design problem
  • A data structures problem in Java
  • A beginner-level Java problem
  • An advanced interview-style Java problem

Requirements:

WRITE MY PAPER