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
Help!!
Eduardwww [97]

the undo option is the right answer



8 0
3 years ago
Read 2 more answers
Computer in country development explain explain explain in presentation.<br>​
yaroslaw [1]

Answer:

A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operations known as programs. These programs enable computers to perform a wide range of tasks. A computer system is a "complete" computer that includes the hardware, operating system (main software), and peripheral equipment needed and used for "full" operation. This term may also refer to a group of computers that are linked and function together, such as a computer network or computer cluster

6 0
3 years ago
Assume that ip , jp , and tp have all been declared to be pointers to int and that result has been declared to be an array of 10
natita [175]

Answer:

The code to this question can be given as:

code:

tp = ip;

ip = jp;

jp = tp;

Explanation:

In this question, it is defined that write code for swapping values that swap the pointers, not the values they point to. So in this code, we assume that all the variable and its value is defined. we simply use the swapping rule that is the first value holds in the new variable and second value hold on the first variable and in the last second variable holds the value of the new variable. In this code, the value will be interchanged or swapped.

3 0
4 years ago
How you will install an operating system on your computer
defon
Someone can install an operating system by disk or removable storage media.

Disk being floppy, tape or commonly a DVD.

Removable storage being a USBdrive.
5 0
3 years ago
What is a utility application that monitors the network path of packet data sent to a remote computer?
stepladder [879]

Answer:

"Traceroute " is the  correct answer.

Explanation:

The traceroute commands in the networking that traces the network path The  traceroute is also displaying the information about the pack delay that is sent over the internet."Traceroute is also known as tracepath it means it calculated the path between the packets in the network. Traceroute takes the one IP address of the computer machine and taking another Ip address to calculate the path between the packets.

Traceroute Is a type of utility application that monitors the network between the packet that is sent into a remote computer.

7 0
3 years ago
Other questions:
  • What must be done if the intended destination hardware is not supported by the chosen OS?
    6·1 answer
  • If you're using the paintbrush tool and want to change the color of the paint being used what should you change
    6·1 answer
  • PLEASE HELP ME ASAP!!!!
    11·1 answer
  • Which processor family is most likely found on recent gaming laptops (Gaming laptops require a lot of computational power)?
    11·1 answer
  • A business that helps people find jobs for a fee
    12·1 answer
  • Write a program to enter a number and test if it is greater than 45.6. If the number entered is greater than 45.6, the program n
    10·1 answer
  • Did it surprise you to discover that the Sun is actually a star in the middle of its life cycle? Why or why not?
    8·1 answer
  • Lucas wants to expand his vocabulary to better understand the sentence below. The insidious burglar moved through the house unhe
    7·2 answers
  • A hacker using information gathered from sniffing network traffic uses your banking credentials from a recent transaction to cre
    6·1 answer
  • Why do meteorologists use data such as temperature, wind speed, and air
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!