Hi! I'm a beginner in Java can you share an answer for this assignment since I already been doing this for a week and I don't know how to answer.

Create a Student class with those attributes:

  1. firstName
  2. lastName
  3. grades (it contains grades between 0 and 10)
  4. gradesAverage
    The Student class will have a constructor to initialize it names.
    The Student class also has 6 methods:
  5. One to get average
  6. 2 other ones for the names
  7. A last one for the grades
  8. A method to add grades , for this one you’ll have to
    check if the grade is a number, if it’s not return an error
    code. After this the grade has to fit between 0 and 10 if

it doesn’t fit, return another error code. The method

also have to update the average.

  1. A method that return a description with the names and
    grade average, example “Maulana Romar John, has a
    grade average of 10/10 ”
    Once the class is done create a program to test it

We don't do your homework for you.

So, to move things forward, you'll need to be more specific than simply posting your assignment question and expecting others to do it for you.

Show us the code you have produced so far, and tell us where you are getting stuck, and then maybe someone can help...

Thank you for your response. Yeah, I am so sorry. Here's my code..I am stuck in determining the string if it is a number or not.

 public void inputGrades(){
       String[] grades = new String[6]; 
   int size = grades.length;
   for(int j = 0; j < size; j++){
       grades[j] = captain.nextLine();

   public double Addgrades(String[] grades){
   int size = grades.length;
   for(int j = 0; j < size; j++){
       double grade = Double.parseDouble(grades[j]);
       if(grade > 0 ){
          if(grade > 0 && grade < 10)
          this.sum = this.sum + grade;
   return this.gradesAverage = sum/size;

When you call parseDouble passing a string that cannot be parsed as a number Java will throw a NumberFormatException
You can put your parseDouble inside a try block and catch the exception - your catch block will be executed if and only if the string does not represent a valid number.