Write the word or phrase that best completes each statement
Write the word or phrase that best completes each statement or answers the question. Write a method that has two integer arguments and returns the Greatest Common Factor. The GCP is the largest factor that will divide into the two numbers evenly. Example, given the number 16 and 24, the CCF would be 8. Write a method to calculate the hypotenuse of a right triangle. A right triangle has is made up of two legs and the hypotenuse. The method should have two arguments (leg 1 and Ieg2) and return the value of the hypotenuse.
Solution
48) method to calculate the GCF
public int findGCD(int number1, int number2) {
if(number2 == 0){ return number1; }
return findGCD(number2, number1%number2); }
49) Method to calculate the hypotenuse of the Right Angle triangle
public int findHypotenuese(int base, int perpendicular)
{
return Math.sqrt(Math.pow(height,2)+Math.pow(base,2));
}
