Function Procedure in Java

Posted by Lhea Bernardino on Stack Overflow See other posts from Stack Overflow or by Lhea Bernardino
Published on 2012-10-08T03:11:20Z Indexed on 2012/10/08 3:37 UTC
Read the original article Hit count: 67

Filed under:

Create a program that will ask the user to enter 3 numbers using for loop, then test the numbers and display it in ascending order.

Sample Input: 5 2 7

Sample Output: 2 5 7

I'm stuck with the testing procedure. I don't know how to test the numbers since the variable holding those numbers is just a single variable and inside the for loop

here is my sample code:

import javax.swing.JOptionPane;
public class ascending
{
  public static void main(String args[])
   {

 for(int x= 0; x<3;x++)
 {
  String Snum = JOptionPane.showInputDialog("Enter a number");
  int num = Integer.parseInt(Snum);
 }

 <Here comes the program wherein I will test the 3 numbers inputted by the user and
   display in ascending order. I don't know where to start. :'( >

© Stack Overflow or respective owner

Related posts about swing