Can you do the java program

Develop a Java application that will read students’ details and display the mark list
Input Enter rollno, name and marks for 3 courses
Output Print the details of each student along with the result
Process Create a class Student with 5 variables. Inside the parameterized constructor, assign
values for these 5 variables. Create methods for calculating and displaying results.
Create a class MarkList that instantiates Student class. Read the details of students
and call the methods to calculate result and display the mark list.

Test Case Input Expected output Obtained output
1 How many students? 3
1 rex 76 45 98
2 sam 65 87 22
3 roy 59 95 89

Pass
Fail
Pass

Source Code
package marklist;
public class Student {
int rollno;
String name;
int mark1, mark2, mark3;
String result;
public Student(){}
public Student(int r, String n, int m1, int m2, int m3){
/* Assign the parameters to data members /
}
public void calculate_result() {
/
if mark1, mark2 and mark3 are 40 and above, result=”Pass”
Otherwise result=”Fail” /
}
public void display(){
/
display rollno, name, mark1, mark2, mark3
and result, in one line */
}
}

package marklist;
import java.util.Scanner;
public class MarkList {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.print("How many students? ");
int max=sc.nextInt();
// create and initialize
Student[] student=new Student[max];
for(int i=0; i<max; i++)
student[i]= new Student();
// read values
for(int i=0; i<max; i++){
System.out.print("Enter rollno: ");
student[i].rollno=sc.nextInt();
// discard new line character
sc.nextLine();
/* similarly read values for name, mark1, mark2, mark3 /
}
// calculate result and display
for(int i=0; i<max; i++){
/
call methods: calculate_result() and display() */
}
}
}
Extra Credit

  1. Revise the declaration of variables mark1, mark2, mark3 as double data type such as
    double mark1, mark2, mark3;
    Rerun your code by making the required changes.
  2. Use try-catch statement to handle the following situations. Catch the specific exception and display
    an error message and exit your program safely by calling System.exit(0)
    a) Users may enter non-integer for rollno, instead of int value. For example,
    Enter rollno: fkdf
    b) Users may enter non-integer for marks instead of int value. For example,
    Enter mark: wxx
    c) Users may enter integers for student name, instead of String.
    Enter name: 83947
  3. Users may enter negative values for marks or a value more than 100 for marks. So, if any mark is a
    negative number or over 100, display appropriate error message and exit your program safely