Can someone tell me why this isnt compiling!

im recieving one syntax error but its still not compiling! If anyone could help me out, id really appreciate it!! ^.^

import javax.swing.JOptionPane;

publicclass TestOut{

publicstaticvoid main(String [] args){

String StudentName;

double gpa;

double score;

StudentName = name();

gpa = StudentGpa(StudentName);

int questions = Integer.parseInt(JOptionPane.showInputDialog(null,"Enter the No. of questions you got right"));

MinScore(questions);

}

privatestatic String name(){

String EnterName=JOptionPane.showInputDialog(null,"Enter students Name ");

return EnterName;

}

privatestaticdouble StudentGpa (String EnterName){

finaldouble MinGpa = 2.5;

double EnterGpa;

EnterGpa = Double.parseDouble(JOptionPane.showInputDialog(null,"Enter" + EnterName +"'s GPA:"));

if (EnterGpa >= MinGpa)

return EnterGpa;

else

JOptionPane.showInputDialog(null,"Your GPA does not qualify you to sit for this exam, Please register for IT 103");

System.exit(0);

}

}

privatestaticvoid MinScore (int num){

finaldouble Questions = 60;

finaldouble StudentScore = 0.75;

double FinalScore;

FinalScore = num/Questions;

if (FinalScore >= StudentScore)

JOptionPane.showMessageDialog(null,"You passed the IT 103 Testout! You will see the credits on your transcript within 4 weeks.");

else

JOptionPane.showMessageDialog(null,"You did not pass the exam. You will need to take IT 103");

}

}

[3168 byte] By [kumiko2ua] at [2007-11-26 20:18:14]
# 1
Paste in the complete, exact error message and make it clear on which line it is occurring.
jverda at 2007-7-10 0:41:42 > top of Java-index,Java Essentials,New To Java...
# 2
TestOut.java:39: missing return statement}^1 error
kumiko2ua at 2007-7-10 0:41:42 > top of Java-index,Java Essentials,New To Java...
# 3
And which line is that? I'm not going to try to count to your line 39.
jverda at 2007-7-10 0:41:42 > top of Java-index,Java Essentials,New To Java...
# 4

The problem is you're not returning anything in your else block. Yes, I know that it will terminate at System.exit(0) but the compiler still expects you to provide a return statement. So just add one in:

private static double StudentGpa (String EnterName){

final double MinGpa = 2.5;

double EnterGpa;

EnterGpa = Double.parseDouble(JOptionPane.showInputDialog(null,"Enter" + EnterName + "'s GPA:"));

if (EnterGpa >= MinGpa)

return EnterGpa;

else

JOptionPane.showInputDialog(null,"Your GPA does not qualify you to sit for this exam, Please register for IT 103");

System.exit(0);

return 0;

}

kablaira at 2007-7-10 0:41:42 > top of Java-index,Java Essentials,New To Java...
# 5
okie!!!Ive got it now!!Thanks so much!!^. ^
kumiko2ua at 2007-7-10 0:41:43 > top of Java-index,Java Essentials,New To Java...
# 6
This is something that gets people who are new to java all the time, you just have to check through your code and think "Is there any circumstances where this return statement cannot be reached?"
Rob-UKa at 2007-7-10 0:41:43 > top of Java-index,Java Essentials,New To Java...
# 7
[quote]im recieving one syntax error but its still not compiling! If anyone could help me out, id really appreciate it!! ^.^[/quote]Of course it won't compilte, because there is still syntax error(s) in it! Doesn't matter if there is one of them, or a whole bunch
Clem1986a at 2007-7-10 0:41:43 > top of Java-index,Java Essentials,New To Java...