1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ratling [72]
3 years ago
12

1. 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 This is a sample run of your program: Enter·one·number:7↵ Enter·a·second·number:49↵ 49·is·a·multiple·of·7↵ Do·you·want·to·enter·another·pair(y/n)?Enter·one·number:7↵ Enter·a·second·number:28↵ 28·is·a·multiple·of·7↵
Computers and Technology
1 answer:
zhannawk [14.2K]3 years ago
8 0

Answer:

see explaination for code

Explanation:

Implement using JAVA

import java.util.Scanner;

public class Multiples {

public static boolean isMultiple(int first, int second){

if(second%first == 0)

return true;

else

return false;

}

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

while(true){

System.out.print("Enter one number: ");

int first = sc.nextInt();

System.out.print("Enter a second number: ");

int second = sc.nextInt();

if(isMultiple(first, second))

System.out.println(second+" is multiple of "+first);

else

System.out.println(second+" is not multiple of "+first);

System.out.print("Do you want to enter another pair(y/n)? ");

char c = sc.next().charAt(0);

if('y' != Character.toLowerCase(c))

break;

}

}

}

/*

Sample run:

Enter one number: 7

Enter a second number: 28

28 is multiple of 7

Do you want to enter another pair(y/n)? y

Enter one number: 8

Enter a second number: 24

24 is multiple of 8

Do you want to enter another pair(y/n)? y

Enter one number: 4

Enter a second number: 2

2 is not multiple of 4

Do you want to enter another pair(y/n)? n

*/

You might be interested in
What is meant by editing a document​
Doss [256]

Answer: “Editing” in general means fixing problems in a written document so that it has no mistakes and is easy to read

Explanation: Yeah

5 0
3 years ago
Read 2 more answers
HELP PLSS‼️ Which are the following are considered peripherals? Mark all that are correct
My name is Ann [436]

Answer:

Speaker, Keyboard, Monitor, Mouse

Explanation:

A peripheral device is used to put input into (or receive output from) a computer. Parts of a computer wouldn't be considered peripheral.

5 0
3 years ago
7d2b:00a9:a0c4:0000:a772:00fd:a523:0358
motikmotik

Answer:

yh3iuskjldnsjfhbcgfihekwfhei3wh8hfefbgp

Explanation:

6 0
3 years ago
Value or power of a network grows exponentially as a function of the number of network members. this is known as ________ law.
mel-nik [20]
Value or power of a network grows exponentially as a function of the number of network members. this is known as Metcalfe's law. According to this law <span>the value (the power) of a </span>telecommunications network<span> is </span>proportional to the square of the number of connected users of the system (network members). Metcalfe's Law <span>characterizes many of the </span>network effects<span> of communication technologies and networks such as the </span>Internet<span>, </span>social networking<span> and the </span>World Wide Web<span>.</span> 
6 0
3 years ago
Difference between ancient and modern mode of information <br> transmission
ELEN [110]
Ancient mode of transmission are used by people in the past while modern mode of transmission are used by present people
4 0
3 years ago
Other questions:
  • You are given a network of 10.50.24.0/21, which contains 2,048 addresses. what subnet mask should you use to divide this into fo
    7·1 answer
  • In order to accomplish the same goal, a person can click and hold down the mouse button and drag to the right, or hold Shift and
    10·1 answer
  • As a chemical engineer, what would you be most likely to do in your job?
    15·1 answer
  • Text documents images audio clips and software applications are all examples of blank that are stored in files
    8·2 answers
  • What will the following segment of code output?
    7·1 answer
  • Can you get in trouble for copying something you thought you were allowed too reddit?
    9·1 answer
  • Indicate whether the following statements are true or false:
    14·2 answers
  • Were so deleted files go
    15·1 answer
  • What are the fundamental activities that are common to all software processes?
    9·1 answer
  • Which of the following shows how to correctly declare pointer variable x?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!