Question: 6.16 (Multiples) Write a method isMultiple that determines, for a pair of integers , whether the second integer is a multiple of the first. The
6.16 (Multiples) Write a method isMultiple that determines, for a pair of integers , whether the second integer is a multiple of the first. The method should take two integer arguments and return true if the second is a multiple of the first and false otherwise. [Hint: Use the remainder operator .] Incorporate this method into an application that inputs a series of pairs of integers (one pair at a time) and determines whether the second value in each pair is a multiple of the first.har()
Prompts:
Enter a second number: Enter one number:
Sample Outputs :
Enter one number:Enter a second number:49 is a multiple of 7 Do you want to enter another pair(y/n)?Enter one number:Enter a second number:28 is a multiple of 7 Do you want to enter another pair(y/n)?Enter one number:Enter a second number:42 is a multiple of 7 Do you want to enter another pair(y/n)?Enter one number:Enter a second number:7 is not a multiple of 42 Do you want to enter another pair(y/n)?Enter one number:Enter a second number:25 is a multiple of -5 Do you want to enter another pair(y/n)?Enter one number:Enter a second number:12 is a multiple of -12 Do you want to enter another pair(y/n)?Enter one number:Enter a second number:9 is not a multiple of 56 Do you want to enter another pair(y/n)?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
