Create a java class called student with the following


Create a Java class called student with the following instance variables:

• private String studentName;
• private int [] grades; //an array of grades

Include setter and getter methods to set and get these 2 properties. The setter method for the grades instance array variable - setGrades() - should take a single argument which is an array of int with the grades already filled in. setGrades() should be used if statement(s) to make sure that each grade value in the array parameter is valid (between 0 and 100) - you will need to use a loop in conjunction with the if-statement(s) to do this efficiently. If a grade is out of bounds,setGrades() should set that grade value to 0. The array that you pass to setGrades() must hold between 3 and 5 grades.

Include a method called outputGrade() that averages up all the grades in the student grades array and then uses a switch statement to output grade conversions based on the following criteria:

• For values from 0-59, your program should output: "Student has failed this class"
• For values from 60-69, your program should output: "Student gets a D"
• For values from 70-79, your program should output: "Student gets a C"
• For values from 80-89, your program should output: "Student gets a B"
• For values from 90-100, your program should output: "Student gets an A"

Where "Student" is the actual name of the student.

Create a test class called TestStudent that instantiates 3 students and sets their names and grades and then calls outputGrade() for each student. For your 3 students, 1must have 3 grades, 1must have 4 grades, and 1must have 5 grades.This is so you will have 3 different array sizes to pass to setGrades(). Make sure that for 1 student,setGrades() is called with 1 grade value that is out of bounds (less than 0 or greater than 100).

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Create a java class called student with the following
Reference No:- TGS01008049

Expected delivery within 24 Hours