My assignment is to be able to input 3 numbers and sort them from lowest to highest, but I'm not quite sure if I'm doing this right and no idea how to return the method. Please help and thank you in advance!
//sort 3 numbers using a method (lowest to highest) import java.util.Scanner; public class Sort_Numbers { public static void main(String[] args) { Scanner input = new Scanner(System.in); //User enters numbers System.out.print("The three numbers from lowest to highest"); displaySortedNumbers(0.0); } //method public static double displaySortedNumbers (double num1, double num2, double num3) { Scanner input = new Scanner(System.in); System.out.println("Please enter three numbers: "); num1 = input.nextDouble(); num2 = input.nextDouble(); num3 = input.nextDouble(); if (num1 > num2 && num1 > num3) { System.out.println(num1); } else if (num2 > num1 && num2 > num3) { System.out.println(num2); } else if (num3 > num1 && num3 > num2) { System.out.println(num3); } return 0.0; } }