I have this wierd kink in this program, it keeps telling me that there is a "missing return statement for public static question. i'm kind of new to JAVA and i've tried everything! please can someone help!
import javax.swing.JOptionPane;
public class arithmetic {
public static void main(String[] args) {
JOptionPane.showMessageDialog(null, "Welcome student!");
int correct=0;
int wrong=0;
char yon;
boolean answer;
do{
answer=question();
if (answer==true){
correct ++;
} else{
wrong++;}
String r;
r= JOptionPane.showInputDialog("Press Y for another question " +
"and Q to quit");
yon= r.charAt(0);
}while(yon == 'y' || yon == 'Y');{
int allanswers;
allanswers= correct + wrong;
JOptionPane.showMessageDialog(null,"You answered" +allanswers+ "questions"+
"altogether and" +correct+ "questions correctly"); }
}
public static char get_choice(){
String s;
s= JOptionPane.showInputDialog(
"Which of the following problems would you like to solve?" +
"(+) Add" +
"(-) Substract" +
"(*) Multiply" +
"(/) Divide");
char choice= s.charAt( 0 );
return choice;}
public static boolean question(){
int a= (int)(Math.random()*(10)+1);
int b=(int)(Math.random()*(10)+1);
char op;
int ka;
String kidsanswer;
op = get_choice();
kidsanswer= JOptionPane.showInputDialog(a+op+b+"=?");
ka= Integer.parseInt( kidsanswer);
int compuanswer;
switch (op){
default:
break;
case '+': compuanswer= a+b;
boolean answer;
if (compuanswer==ka){
JOptionPane.showMessageDialog(null, "Well Done!");
return true;}
else if (compuanswer!=ka){
JOptionPane.showMessageDialog(null, "Wrong, sucker!" +
"The correct answer is:" + compuanswer);
return false;} break;
case '-': compuanswer= a-b;
if (compuanswer==ka){
JOptionPane.showMessageDialog(null, "Well Done!");
return true;}
else if (compuanswer!=ka){
JOptionPane.showMessageDialog(null, "Wrong, sucker!" +
"The correct answer is:" + compuanswer);
return false;} break;
case '*':
compuanswer= a*b;
if (compuanswer==ka){
JOptionPane.showMessageDialog(null, "Well Done!");
return true;}
else if (compuanswer!=ka){
JOptionPane.showMessageDialog(null, "Wrong, sucker!" +
"The correct answer is:" + compuanswer);
return false; } break;
case '/':
compuanswer= a/b;
if (compuanswer==ka){
JOptionPane.showMessageDialog(null, "Well Done!");
return true;}
else if (compuanswer!=ka){
JOptionPane.showMessageDialog(null, "Wrong, sucker!" +
"The correct answer is:" + compuanswer);
return false;} break;
}}
}