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
Systems management involves allocation of computer resources to keep all processes operating smoothly and at maximum efficiency.
olchik [2.2K]

Answer:operating system (OS), program that manages a computer's resources, especially the allocation of those resources among other programs. Typical resources include the central processing unit (CPU), computer memory, file storage, input/output (I/O) devices, and network connections.

Explanation:

8 0
3 years ago
Computer programs typically perform three steps: input is received, some process is performed on the input, and output is produc
-Dominant- [34]
True. Most basic programs follow this structure.
6 0
1 year ago
A(n) _____ measures the ability to juggle a variety of demands, as in a manager's job where the candidate is presented with simu
Tju [1.3M]

Answer: in-basket test

Explanation:

An in-basket test or an in-basket exercise is a test used by firms or governments in recruiting and promoting employees. During the test, job applicants receive some mails, telephone calls, documents and memos.

3 0
4 years ago
Damion recently did an update to his computer and added a new video card. After the update, Damion decided that he would like to
Lerok [7]
Video card device drives need to be updated.
5 0
3 years ago
What is the differnce between concurrent software and sequential software and which one is better with multiprocessors ???
3241004551 [841]

Answer:

Concurrent software is better suited to parallel processing environment represented by multiprocessors as compared to sequential software.

Explanation:

Sequential software corresponds to a code which is executed step by step on  a single processing unit. A concurrent software on the other hand supports parallel execution by splitting the execution across multiple parallely executing component units. A multiprocessor system speeds up concurrent execution by providing independent execution units (processors) for these code segments running parallely. So concurrent software is better suited to multiprocessors.

4 0
3 years ago
Other questions:
  • Your bank contacts you asking you to phone a number supplied in the email.What do you?
    13·2 answers
  • What is one important feature of an AUP?
    14·1 answer
  • As part of the interview process should you compose a thank-you note for the prospective employer and/or interview committee. In
    6·1 answer
  • Charlie is a British national who works in the United States as a novelist for children. Because he is British, he types the wor
    10·2 answers
  • what are the Technologies in regarding of communication technology? Please help me I'll rate you as brainliest!​
    13·1 answer
  • The ____ documents a system at the end of the design phase, identifies any changes since the beginning of the project, and inclu
    10·2 answers
  • Your company's network topology diagrams aren't very detailed so you're helping to improve them. The new set will have separate
    9·1 answer
  • 20. The following are considered as ICT skills EXCEPT
    15·1 answer
  • Anybody wana play 2k21
    9·2 answers
  • ¿Cuántos motores tiene el Toyota Prius y que características poseen?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!