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
spin [16.1K]
2 years ago
13

Write a method called min that takes three integers as parameters and returns the smallest of the three values, such that a call

of min(3, -2, 7) would return -2, and a call of min(19, 27, 6) would return 6. Use Math.min to write your solution.
Computers and Technology
1 answer:
Debora [2.8K]2 years ago
7 0

Answer:

public class Main

{

public static void main(String[] args) {

 System.out.println(min(3, -2, 7));

}

public static int min(int n1, int n2, int n3){

    int smallest = Math.min(Math.min(n1, n2), n3);

    return smallest;

}

}

Explanation:

*The code is in Java.

Create a method named min that takes three parameters, n1, n2, and n3

Inside the method:

Call the method Math.min() to find the smallest among n1 and n2. Then, pass the result of this method to Math.min() again with n3 to find the min among three of them and return it. Note that Math.min() returns the smallest number among two parameters.

In the main:

Call the method with parameters given in the example and print the result

You might be interested in
Write a recursive function num_eights that takes a positive integer pos and returns the number of times the digit 8 appears in p
nata0808 [166]

Answer:

Explanation:

The following is written in Java. It creates the function num_eights and uses recursion to check how many times the digit 8 appears in the number passed as an argument. A test case has been created in the main method and the output can be seen in the image below highlighted in red.

  public static int num_eights(int pos){

       if (pos == 0)

           return 0;

       if (pos % 10 == 8)

           return 1 + num_eights(pos / 10);

       else

           return num_eights(pos / 10);

   }

7 0
2 years ago
What is the body of scientific knowledge based on?
ANTONII [103]
It depend on all such as guess ,observation ,hypothesis and etc
3 0
2 years ago
Read 2 more answers
The correct order of operations is _____. brackets, exponents, division, multiplication, addition, and subtraction subtraction,
bija089 [108]

brackets, exponents, division, multiplication, addition, and subtraction

6 0
3 years ago
Read 2 more answers
Question Workspace Check My Work Copying computer software, video games, movies, or music without paying the producer for them i
Tcecarenko [31]

Answer:

Option B, CUSTOMER MISBEHAVIOR.

Explanation:

Consumer misbehavior can defined as the behavioral acts by consumers which violate the generally accepted norms of conduct in consumption situations, and disrupt the order expected in such situations. Misbehavior by consumers disrupts the openness, impersonal trust, and orderliness of the exchange environment.

Some of the examples of customer misbehavior are: shoplifting, bending rules, breaking rules by ignoring warnings and using products in forbidden or ways not recommended...

* Routinized response behaviour is a type of purchasing scenario whereby the purchaser of a product or a service has past experience with purchasing it and automatically makes the decision to purchase again.

* Psychological influences refers to the workings of the mind or psyche that influences customer decisions.

* Social influences refers to the intentional and unintentional efforts to change another person's beliefs, attitudes, or behavior.

Therefore, the option that best suits the question is option B, CUSTOMER MISBEHAVIOR.

3 0
3 years ago
Which body of water is most likely to be a marine ecosystem?
Sophie [7]

Answer:

The body of water that is most likely to be a marine ecosystem would be an estuary.

Explanation:

An estuary is a widened, often funnel-shaped mouth of a river, where fresh river water and salt sea water are mixed and thus brackish water is created, and where tidal differences can be observed. When a river flows as a system of branches, it is called a delta.

Estuaries often have a great natural value. They typically consist of swallows and salt marshes that are very rich in invertebrates and thus have a great attraction for birds, among other things.

4 0
3 years ago
Other questions:
  • Consider a file system that uses inodes to represent files. Disk blocks are 2KB in size and a pointer to a disk block requires 4
    13·1 answer
  • What is the most recognized and widely used database of published nursing practice literature?
    15·1 answer
  • Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an in
    13·1 answer
  • What type of memory or storage device is prone to losing data if the power goes out?
    5·1 answer
  • Consider the packets exchanged in TCP connection setup between Host A and Host B. Assume that Host A's initial sequence number i
    7·1 answer
  • )finding an unused location in the hash table is called
    5·1 answer
  • A TCP Sender is just about to send a segment of size 100 bytes with sequence number 1234 and ack number 436 in the TCP header. W
    5·1 answer
  • Question #5
    15·2 answers
  • What are 5 good movies like The Breakfast Club or 8 Mile?
    14·2 answers
  • Differences between dot_mattix printer and a line printer
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!