I need it to be an int to return but it keeps saying
----jGRASP exec: javac -g CSCD210Lab8Functions.java
CSCD210Lab8Functions.java:118: incompatible types
found : int
required: java.lang.String
return finalExam;
public static String readFinalScore(Scanner kb)
{int finalExam;
do{
kb.nextLine();
System.out.print("Enter the score of the final-->");
finalExam = kb.nextInt();
kb.nextLine();
if (finalExam<0)
{System.out.print("Invalid answer please try again " );}
}while(finalExam<0);
return finalExam;
i casted it as an int and then kb.nextInt not sure why it's freaking out
public static String readFinalScore(Scanner kb) // return type String
{int finalExam; // finalExam is int
...
return finalExam; // returning int value when it expects String
return type is String
and finalExam
is int.
Change to
public static int readFinalScore(Scanner kb)