// Alex Deines
import javax.swing.*;
public class DeinesAdmissions
{
public static void main(String[] args)
{
String anwserString;
double anwser;
double y;
anwserString= JOptionPane.showInputDialog(null,"Enter your GPA", "GPA", JOptionPane.QUESTION_MESSAGE);
anwser = Double.parseDouble(anwserString);
JOptionPane.showInputDialog(null,"Enter your Admission Test Score", "Test Score", JOptionPane.QUESTION_MESSAGE);
y = Integer.parseInt(anwserString);
if(anwser>=3 && y>=60 || anwser>=0 && y>=85 )
JOptionPane.showMessageDialog(null, "You have been accepted");
else
JOptionPane.showMessageDialog(null, "Sorry we must reject your application");
}
}
Exception in thread "main" java.lang.NumberFormatException: For input string: "3.2" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:580) at java.lang.Integer.parseInt(Integer.java:615) at DeinesAdmissions.main(DeinesAdmissions.java:16)
After I insert the Variables, I get this error code. Could anyone please lead me in the right direction? many thanks <3
Aucun commentaire:
Enregistrer un commentaire