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
What is the address of the first SFR (I/O Register)​
amid [387]

Answer:

The Special Function Register (SFR) is the upper area of addressable memory, from address 0x80 to 0xFF.

Explanation:

The Special Function Register (SFR) is the upper area of addressable memory, from address 0x80 to 0xFF.

Reason -

A Special Function Register (or Special Purpose Register, or simply Special Register) is a register within a microprocessor, which controls or monitors various aspects of the microprocessor's function.

4 0
3 years ago
You can include up to _____ logical conditions in the and function. (487181)
Allushta [10]
Hi ! 

<span>You can include up to <u>255</u> logical conditions in the and function. </span>
8 0
3 years ago
Under what category of programs and apps do databases and enterprise computing fall?
Evgesh-ka [11]
Answer is productivity

Sometimes called the office or personal productivity software, productivity software is dedicated to producing databases, spreadsheets, charts, graphs, documents, graphs, digital video and worksheets. Reason behind the name productivity is due to the fact that it increases productivity in office work.

6 0
3 years ago
Autonomous learners have a vast array of learning strategies in their toolboxes to choose from, most of which are effective in a
sergij07 [2.7K]

Answer:

True

Explanation:

Autonomous learners are individuals who take control of their own learning, either independently or in collaboration with others, and do not rely on teachers. Therefore based on the information provided within the question it can be said that the statement is completely true. Since they take control of their own learning, they use a variety of different techniques and tools that best suite their learning methods.

5 0
4 years ago
5. Many vehicles have indicator lights telling you when your
I am Lyosha [343]

Answer:

A.

Explanation:

The rest is nearly impossible to detect or not worth the time.

8 0
3 years ago
Read 2 more answers
Other questions:
  • What is the program that searches through data bases?
    10·1 answer
  • Is there an answer to these picture?
    12·1 answer
  • Which of the following resources can be used by an OS to communicate with hardware? (Select 2)
    11·1 answer
  • 1. What is Computer Hardware?
    14·1 answer
  • Refer to the exhibit. One end of the cable is terminated as displayed, and the other end is terminated in accordance with the T5
    7·1 answer
  • To uncompress the data back into its original binary state, you simply reverse the process. This technique is an example of what
    7·1 answer
  • If a machine cycle is 2 nanoseconds , how many machine cycles occur each second?
    7·1 answer
  • The Internet:
    12·1 answer
  • Which statement best describes a social impact of computing on the world?
    9·1 answer
  • Ann, a user, reports that her pc is running slower than usual. which tool would best allow you to identify the bottleneck?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!