I'm trying to create a program that read the input of name and mark of students then give out the name and grade of that student in the form GUI output but keep having the problem when compiling.
import javax.swing.*;
public class p
{
private static String getGrade(int mark)
{
String grade;
if (mark<50)
grade="F";
else if (mark<65)
grade="P";
else if (mark<75)
grade="C";
else if (mark<85)
grade="D";
else
grade="HD";
return grade;
}
public static void main (String []args)
{
JOptionPane.showMessageDialog(null,"Welcome to the Mark Entry System");
String studentName = JOptionPane.showInputDialog(null,"Enter student name:");
int mark =Integer.parseInt(JOptionPane.showInputDialog(null,"Enter mark for student (out of 100)"));
String grade = getGrade(int mark);
JOptionPane.showMessageDialog(null,"The grade for " + studentName + " is " + grade);
}
}
String grade = getGrade(mark);in the main class. please share the exception or stacktrace.