In Java Write a method called multiple that takes two intege

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.

Solution

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));
}
}

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

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site