Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In Java Write a method called multiple that takes two integers as its arguments

ID: 3796701 • Letter: I

Question

In Java

Write a method called multiple that takes two integers as its arguments and returns true if the first integer is divisible evenly by the second one (i.e., there is no remainder after division); otherwise, the method should return false. Write a method called reminder that takes an integer as an argument and returns the remainder of that value divided by 7. Write method distance to calculate the distance between two points (x1, y1) and (x2, y2). All numbers and return values should be of type double.

Explanation / Answer

Here are the methods for you:

class MultipleRemainderDistance
{
//Method called multiple that takes two integers as its arguments and returns true if
//first integer is divisible evenly by the second one, otherwise, the method returns false.
public static boolean multiple(int num1, int num2)
{
return num1 % num2 == 0;
}
//Method called remainder that takes an integer as an argument and returns the remainder
//of the value divided by 7.
public static int remainder(int num)
{
return num % 7;
}
//Method called distance to calculate the distance between two points (x1, y1), and (x2, y2).
//All number and return values should be of type double.
public static double distance(double x1, double y1, double x2, double y2)
{
return Math.sqrt(Math.pow(x1-x2, 2) + Math.pow(y1-y2, 2));
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote