Question 1
Consider a scenario where you are developing a program to analyze and manipulate student data. The program should provide the functionality to input and process student information, including their names, grades, and other relevant details.
Design a class called Student with the following attributes and methods:
Attributes:
name (String): represents the student's name.
grades (int[]): stores the students grades for different subjects.
Methods:
Student(String name): constructor that initializes the student's name.
void addGrade(int grade): adds a grade to the student's grades array.
double calculateAverageGrade(): calculates and returns the average grade of the student.
String getGradeStatus(): returns the grade status of the student based on their average grade. (e.g., "Pass" if average grade >= 60, "Fail" otherwise)
Suggested solution:
1.1 Write a Java code snippet to create an object of the Student class with the name "John" and add the grades 80, 75, 90, and 85 to the student's grades array.
1.2 Write a loop to iterate through the student's grades array and calculate the total grade points earned by the student. Consider the grade points as the grade itself (e.g., A=90, B=80, C=70, etc.).