numbers that the user inputs. You must use JoptionPane to input the three numbers. A first method must be called and used to develop logic to find the smallest of the three numbers. A second method must be used to print out that smallest number found.

Respuesta :

Input the three numbers. A first method must be called and used to develop logic to find the smallest of the three numbers. A second method must be used to print out that smallest number found.

Explanation:

  • Input of 3 numbers.
  • Then the numbers are checked to print the smallest one.

import java.util.Scanner;

public class Exercise1 {

public static void main(String[] args)

   {

       Scanner in = new Scanner(System.in);

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

       double x = in.nextDouble();

       System.out.print("Input the Second number: ");

       double y = in.nextDouble();

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

       double z = in.nextDouble();

       System.out.print("The smallest value is " + smallest(x, y, z)+"\n" );

   }

  public static double smallest(double x, double y, double z)

   {

       return Math.min(Math.min(x, y), z);

   }

}