Write the following method to run a prgram that sorts three numbers. public stat
ID: 3630917 • Letter: W
Question
Write the following method to run a prgram that sorts three numbers.
public static void displaySortedNumbers(
double num1, double num2, double num3)
Here is what we have so far but it won't compile or run it is missing a main method
public void displaySortedNumbers(double num1, doublenum2, double num3)
{
// swap numbers so that num1 < num2 < num3
if(num1 > num2)
{
double temp = num1;
num1 = num2;
num2 = temp;
}
if(num1 > num3)
{
double temp = num3;
num3 = num1;
num1 = temp;
}
// now num1 is smallest
if(num2 > num3)
{
double temp = num3;
num3 = num2;
num2 = temp;
}
// print numbers
System.out.println(num1+" "+num2+" "+num3);
}