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]( text`


/ error: missing return statement
1 error
public class MainActivity {

// Add generateRandomNumber() here
int questionsRemaining;
int max = questionsRemaining - 1; 
double deciTotal;
int createdTotal;

int generateRandomNumber(int max){
  double number = 
  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](  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?