# Cumulative project 3, Main Activity

When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!`[Preformatted text] [Cumulative project 3](https://gist.github.com/28f70c3af9dac49ac911730378e07a29)`Preformatted text`

.

``````/MainActivity.java:27: error: missing return statement
}
^
1 error
``````
``````public class MainActivity {

int questionsRemaining;
int max = questionsRemaining - 1;
double deciTotal;
int createdTotal;

int generateRandomNumber(int max){
double number =
Math.random();
deciTotal = number * max;

double deciTotal = (int) createdTotal;
return createdTotal;
}
String getGameOverMessage(int totalQuestions, int totalCorrect){

if (totalCorrect == totalQuestions){
System.out.println("You got all 6 right! You won!");
} else {

System.out.println("You got " + totalCorrect + " Correct, Hang your head in shame!");

}
}
}

**I'm receiving this error for the code in the link above.  How do I create the proper return statement?`**

Preformatted text`

If you want to have the best chances of getting a useful answer quickly, make sure you **follow our guidelines** about how to [ask a good question](http://bit.ly/usecodecademyforumsbetter).  That way you'll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer! :slight_smile:``````

You’ve declared a return type of `String` for this method. It needs to return a `String`. Printing is not the same as returning.

1 Like

I kinda understand this code. What is the problem?

Mate, When you declare method with void it doesn’t return anything, on the other hand when you declare method with type then you have to return that type at the end into the scope of the method.

According to rules, as any direct solution is not allowed therefore I can not write the specific code here, but I hope it will help.

``````public String blabla {
code goes  ......;
return String(type);
}
``````

Anyways, Your code helps me too to complete the project! Thanks for that @james987-beep