I'm sure I am doing something stupid but I can't find it. I want to enter the triangle data in the method and every time I try to compile the program I get the error message--cannot find symbol. Please tell me what I have done wrong.
import java.io.*;
import java.util.*;
public class trianglemethod {
public static void main(String [] args)
{
Scanner kbreader = new Scanner (System.in);
int choice = 0;
String ans = "y";
do
{
System.out.println("Are you entering");
System.out.println("1. leg and leg");
System.out.println("2. leg and hypotenuse");
choice = kbreader.nextInt();
kbreader.nextLine();
if (choice == 1)
legs();
// else
// hypo();
kbreader.nextLine();
System.out.println("Would you like to run this again? (Y/N)");
ans = kbreader.nextLine();
}
while (ans.equalsIgnoreCase("Y"));
}//main
public static void legs()
{
double leg1=0;
double leg2=0;
double hypot=0;
System.out.println("Enter the values for leg1 and leg2");
leg1 = kbreader.nextDouble(); //the error shows up on this line
leg2 = kbreader.nextDouble(); // and this line
hypot = Math.sqrt(leg1*leg1 + leg2 * leg2);
System.out.println("The sides of the triangle are: "+leg1+" "+leg2+" "+ hypot);
}
}