Answer:
Explanation:
The following code is written in Java and creates both of the requested methods. The methods compare the three inputs and goes saving the largest and smallest values in a separate variable which is returned at the end of the method. The main method asks the user for three inputs and calls both the LargestNumber and SmallestNumber methods. The output can be seen in the attached image below.
import java.util.Scanner;
class Brainly {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter number 1: ");
int num1 = in.nextInt();
System.out.println("Enter number 2: ");
int num2 = in.nextInt();
System.out.println("Enter number 3: ");
int num3 = in.nextInt();
System.out.println("Largest Value: " + LargestNumber(num1, num2, num3));
System.out.println("Smallest Value: " + SmallestNumber(num1, num2, num3));
}
public static int LargestNumber(int num1, int num2, int num3) {
int max = num1;
if (num2 > num1) {
max = num2;
}
if (num3 > max) {
max = num3;
}
return max;
}
public static int SmallestNumber(int num1, int num2, int num3) {
int smallest = num1;
if (num2 < num1) {
smallest = num2;
}
if (num3 < smallest) {
smallest = num3;
}
return smallest;
}
}