182k views
2 votes
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.

User Svural
by
5.5k points

1 Answer

3 votes

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.

Step-by-step 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)+"\\" );

}

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

{

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

}

}

User Paleozogt
by
4.7k points