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]
3 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]3 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
A constructor can be overloaded with more than one function which has the same name but with what two different things
andreyandreev [35.5K]
<h2>Answer:</h2>

i. Number of parameters

ii. Type of parameters

<h2>Explanation:</h2>

When there are two or more constructors, definitely with the same name, in a given class, then the constructors are said to be overloaded. An overloaded constructor appears declared many times in a class but each time with different number of parameters and/or type of parameters.

For example, given a class Test, the following combination of constructors can exist;

i. public Test(int x){

   

 }

ii. public Test(String m){

     

  }

iii. public Test(int a, String b){

 

}

<em>The following should be noted;</em>

In the case of combination (i) and (ii), the constructors have the same number of parameters but different type of parameter. In other words, they both have 1 parameter but while the first one has a parameter type of <em>int</em>, the second has a parameter type of <em>String</em>.

In the case of combination (ii) and (iii), the constructors have different number of parameters and of course different type of parameters. In other words, the second constructor has 1 parameter of type <em>String</em> while the third constructor has 2 parameters of types <em>int</em> and <em>String</em>.

5 0
3 years ago
Jemima has finished formatting her main headings. She now wants to format her two subheadings. She wants to apply the format of
klasskru [66]

Answer:

the Format Painter feature

6 0
3 years ago
QUESTION 9 / 10
In-s [12.5K]

Answer:

The answer is C. the bank will cancel your credit card.

Explanation:

5 0
3 years ago
Look at the following assignment statements: food1 = "water" food2 = "melon" What is the correct way to concatenate the strings?
Ilia_Sergeevich [38]

Programming language in R studio or R, food1 = "Water" food2 = "Melon"

Concatenate = paste("food1","food2"), will give  "Water Melon". In excel Water in range("B2"), Melon in range("B3"), use =CONCATENATE(B2, " ", C2) it gives Water Melon.

Explanation:

  • R studio is analytical tool which comes from programming S language.
  • We need 3 variable Food1,Food2 and Concatenate in R studio.
  • Food1 = "Water" inverted commas mean it is character.
  • Food2 = "Melon" inverted commas mean it is a character.
  • "=" gives a variable notification.
  • Concatenate is a variable which we use function paste .
  • Concatenate = paste(food1,food2) result "water melon"
  • paste(..., sep = "" , collapse = Null)
  • It is function from R.
  • Excel Water in B2 and Melon in C2 use the formula concatenate.
  • =CONCATENATE(B2, " ",C2) in between commas means space.
5 0
3 years ago
Write an if-else statement that determines whether the variable points is outside the range of 9 to 51. If points is outside the
Mrac [35]

Answer: Using Python

Explanation:

num = int(input("Enter number > "))

if num in range (9, 52):

   print("Valid Points")

else:

   print("Invalid Points ")

8 0
2 years ago
Other questions:
  • The largest country in South America
    7·1 answer
  • An isp is a group of updates, patches, and fixes that apply to specific oss.
    14·1 answer
  • Which of the following refers to a combination of hardware and software that ensures only authorized individuals gain entry into
    11·1 answer
  • Every time you are asked to work with others, you are being asked to:
    6·2 answers
  • What is a orogram to block access to websites
    15·1 answer
  • Neymar machine that Run on electricity
    11·1 answer
  • Please help ASAP !!!
    15·1 answer
  • Describe the layout of an article on Wikipedia​
    7·1 answer
  • Message queues allow for programs to synchronize their operations as well as transfer data. How much data can be sent in a singl
    10·1 answer
  • If I want to make it look like slide number one is turning a page to slide number two, what
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!