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
DaniilM [7]
3 years ago
5

Write a function named minMax() that accepts three integers arguments from the keyboard and finds the smallest and largest integ

ers. Include the function minMax() in a working program. Make sure your function is called from main().Test the function by passing various combinations of three integers to it.
Computers and Technology
1 answer:
Bad White [126]3 years ago
5 0

Answer:

public class Main

{

public static void main(String[] args) {

 minMax(1, 2, 3);

 minMax(100, 25, 33);

 minMax(11, 222, 37);

}

public static void minMax(int n1, int n2, int n3){

    int max, min;

    if(n1 >= n2 && n1 >= n3){

        max = n1;

    }

    else if(n2 >= n1 && n2 >= n3){

        max = n2;

    }

    else{

        max = n3;

    }

   

    if(n1 <= n2 && n1 <= n3){

        min = n1;

    }

    else if(n2 <= n1 && n2 <= n3){

        min = n2;

    }

    else{

        min = n3;

    }

    System.out.println("The max is " + max + "\nThe min is " + min);    

}

}

Explanation:

*The code is in Java.

Create a function named minMax() that takes three integers, n1, n2 and n3

Inside the function:

Declare the min and max

Check if n1 is greater than or equal to n2 and n3. If it is set it as max. If not, check if n2 is greater than or equal to n1 and n3. If it is set it as max. Otherwise, set n3 as max

Check if n1 is smaller than or equal to n2 and n3. If it is set it as min. If not, check if n2 is smaller than or equal to n1 and n3. If it is set it as min. Otherwise, set n3 as min

Print the max and min

Inside the main:

Call the minMax() with different combinations

You might be interested in
If a packet gets "sucked down a black hole" (figuratively speaking) and is not received by its sender, and no message is sent ba
Serga [27]

Answer:

iso

Explanation:

3 0
2 years ago
PLEASE ANSWER CORRECTLY
Bess [88]

Answer:

If you know how many passes you'll be making, a for loop is most suitable.

If you do not know ahead of time, the while loop is better, since the while condition will decide if you're going to make another round.

5 0
3 years ago
A ____ software helps you create and display worksheets containing data
kondor19780726 [428]

the answer would be spreadsheet

8 0
3 years ago
Which Traffic Source dimensions does Google Analytics automatically capture for each user who comes to your site?A. Source, Keyw
LenaWriter [7]

For each user who comes to your site the google analytics automatically capture the traffic source dimensions Source, Medium, Campaign name.

<u>Explanation:</u>

Source:

  • There cannot be any reference to a website without an origin source.
  • The source is basically the origin of your traffic such as a search engine (google) or a domain (ex: Twitter).

Medium:

  • Every referral to a website also has a medium along with the source.
  • examples are -:  unpaid search, "cost per click", referral, mail.

Campaign name:

  • The campaign Name is the name referring to the google ads campaign.
5 0
4 years ago
NEED HELP ASAP JAVA
Bas_tet [7]
I think is C tbh sorry if that’s wrong my fault
4 0
3 years ago
Other questions:
  • PYTHON CODE ONLY:
    7·1 answer
  • When the word “computer” was coined, what did it mean?
    12·1 answer
  • What are the role, responsibilities, and required background of the production designer of a film?
    6·1 answer
  • Which of the following is considered both an input and output peripheral?
    10·1 answer
  • Look at the data set below. {6, 7, 12, 5, 7, 11, 10, 7, 6} In this data set, what is the mode?
    9·2 answers
  • Arun is 5 years older than Anu. five years ago, the ratio of their ages was 3:2 . find their present age​
    10·2 answers
  • You have just installed a new sound card in your system, and Windows says the card installed with no errors. When you plug up th
    5·1 answer
  • What role/service is windows 2012 server backup part of?
    5·1 answer
  • Is a tv a
    6·1 answer
  • there is a structure called employee that holds information like employee code, name, date of joining. Write a program to create
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!