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
Leno4ka [110]
3 years ago
10

Write a program whose inputs are three integers, and whose outputs are the largest of the three values and the smallest of the t

hree values. If the input is 7 15 3, the output is: largest: 15 smallest: 3 Your program should define and call two functions: Function LargestNumber(integer num1, integer num2, integer num3) returns integer largestNum Function SmallestNumber(integer num1, integer num2, integer num3) returns integer smallestNum The function LargestNumber should return the largest number of the three input values. The function SmallestNumber should return the smallest number of the three input values.
Computers and Technology
1 answer:
arlik [135]3 years ago
8 0

Answer:

import java.util.*;

public class Main

{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

    System.out.print("Enter the first number: ");

    int n1 = input.nextInt();

    System.out.print("Enter the second number: ");

    int n2 = input.nextInt();

    System.out.print("Enter the third number: ");

    int n3 = input.nextInt();

 System.out.println("largest: " + LargestNumber(n1, n2, n3));

 System.out.println("smallest: " + SmallestNumber(n1, n2, n3));

}

public static int LargestNumber(int num1, int num2, int num3){

    int largestNum = 0;

    if(num1>=num2 && num1>=num3)

        largestNum = num1;

    else if(num2>=num1 && num2>=num3)

        largestNum = num2;

    else if(num3>=num1 && num3>=num2)

        largestNum = num3;

       

    return largestNum;

}

public static int SmallestNumber(int num1, int num2, int num3){

    int smallestNum = 0;

    if(num1<=num2 && num1<=num3)

        smallestNum = num1;

    else if(num2<=num1 && num2<=num3)

        smallestNum = num2;

    else if(num3<=num1 && num3<=num2)

        smallestNum = num3;

       

    return smallestNum;

}

}

Explanation:

Create function called LargestNumber that takes three parameters, num1, num2, num3. Find the largest number using if else structure among them and return it. For example, if num1 is both greater than or equal to num2 and num3, then it is the largest one.

Create function called SmallestNumber that takes three parameters, num1, num2, num3. Find the smallest number using if else structure among them and return it. For example, if num1 is both smaller than or equal to num2 and num3, then it is the smallest one.

Inside the main, ask the user for the inputs. Call the functions and print the largest and smallest.

You might be interested in
2. Suppose you want to write a method that prints a heading on a new output page, along with a page number that is 1 in the firs
Ilia_Sergeevich [38]

Answer:

This can be done in both Java and C#, using a static (or class) data member for the page number.

Explanation:

7 0
3 years ago
Question 1<br> What does the % find?<br> The product<br> The mode<br> The quotient<br> The remainder
Paul [167]
The correct answer is the remainder
7 0
4 years ago
What are the uses of ICT in health department write at least 6 uses in brief​
Alinara [238K]

Answer: See Explanation

Explanation:

The uses of ICT in health department include:

1. ICT helps in the improvement of the safety and the satisfaction of patients as new technologies are being developed to endure that patients are treated faster and their chance of survival increase.

2. ICT helps in looking for prevention measures which will be used to eradicate diseases.

3. ICT helps in the storage of medical data electronically. This will help in the easy retrieval of information.

4. ICT helps in the spread of information and also ensures distant consultation which are essential to achieving health related goals. e.g telemedicine.

5. ICT helps in the easy and fast spread of information and also facilitates cooperation and enhances teamwork among the health workers.

6. ICT brings about efficiency and effectiveness of administrative systems.

4 0
3 years ago
To create an interactive Pivot Table for the web, we use a Ms office web component known as,
charle [14.2K]

Answer: Pivot Table Report

Explanation:

To create an interactive Pivot Table for the web, we can use a Ms office web component which is known as the pivot table report.

We should note that the pivot tables are simply used for the summarizing of data. Huge amounts of data can be processed with them, after which a report showing sums, averages, totals and every other calculations can be gotten.

5 0
3 years ago
Acetylene is a gas which burns rapidly on its own, and is considered highly explosive. A) True B) False
coldgirl [10]

True...........................

3 0
3 years ago
Read 2 more answers
Other questions:
  • If you are trying to create a web page for your band and having difficulty creating links to other groups on your page, what is
    7·1 answer
  • How to highlight text on a kindle paperwhite?
    7·1 answer
  • 3. You are a network administrator responsible for all network platforms and services. The Teta Company currently has only one b
    13·2 answers
  • How do you change between worksheets inside an excel workbook?
    13·2 answers
  • What are the two types of computers
    15·2 answers
  • Enumeration is defined as the process of extracting user names, machine names, network resources, shares, and services from a sy
    13·1 answer
  • What are the advantages of businesses using Twitter ?
    12·1 answer
  • I thought the answer was senior manager see on google it says
    8·1 answer
  • What will be the values of ans, x, and y after the following statements are executed? int ans = 35, x = 50, y =50; if ( x &gt;=
    7·2 answers
  • How does our behavior change when we know we're being watched?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!