// 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)
После вставки переменных я получаю этот код ошибки.Может ли кто-нибудь, пожалуйста, привести меня в правильном направлении?