The function reads numbers from the user, summing them up in the process until the user enters the string "end". It then stops input & displays the avg of the numbers.
void mean() {
int mean1,f1=0,c1=0,g1;
boolean k1;
String end=null;
System.out.println("Enter numbers");
while(k1=false)
{
end=input.nextLine();
if(isNumeric(end)==true)
{
g1=Integer.parseInt(end);
f1=f1+g1;
c1=c1+1;
}
else if(end=="end")
{
k1=true;
}
}
mean1=f1/c1;
System.out.println("The mean is: "+mean1);
}
However I am unable to escape the loop no matter what, even when the user enters "end".