Create a program that will accept 20 numbers and arrange them in ascending order. The program should determine the distinct numbers and the number of occurrences for each number (or the frequency). Display the supplied values, the distinct numbers and the frequency of each distinct numbers.

Your program should use three arrays that will hold the entered numbers, distinct numbers, and the frequency, respectively.

Use the following numbers in your first run:
1 37 25 1 56 8 6 9 11 8 54 56 20 25 1 8 6 20 56 56

Enter 20 numbers:
1
37
25
1
56
8
6
9
11
8
54
56
20
25
1
8
6
20
56
56

Your entered numbers are:
20 37 25 1 56 8 6 9 11 23 54 56 20 25 1 8 56 20 56 56

Distinct Number	Frequency
1			3
37 			1
25 			2
56 			4
8 			3
6 			2
9 			1
11			1
54			1
20 			2

please give me a hand on this one, i've done the arranging thing, i just a hint on how can i do the rest, please help me, just clues please . . .

how can i do the rest

Please be more specific about what you want to do.

Please be more specific about what you want to do.

ok, my problem is the thing on how to get the distinct number within the 20 entered number and how many times they are entered

What have you tried so far? The program assignment gives you a helpful starting hint, with the part about the three arrays. This narrows down your possible solutions somewhat.

Try thinking about it with a piece of paper. I'm going to read off a list of numbers to you, you're going to write them down, then you're going to give me a list of unique numbers and how many times I read each of them, and you're going to do this by writing down three columns of numbers. How many places will you need in each column, first of all?

import java.util.*;
  public class SfourA  {
  public static void main ( String[] args )  {
    Scanner nix = new Scanner ( System.in );
      System.out.println ( "Enter 20 Numbers: " );
	int inA = nix.nextInt();
	int inB = nix.nextInt();
	int inC = nix.nextInt();
	int inD = nix.nextInt();
	int inE = nix.nextInt();
	int inF = nix.nextInt();
	int inG = nix.nextInt();
	int inH = nix.nextInt();
	int inI = nix.nextInt();
	int inJ = nix.nextInt();
	int inK = nix.nextInt();
	int inL = nix.nextInt();
	int inM = nix.nextInt();
	int inN = nix.nextInt();
	int inO = nix.nextInt();
	int inP = nix.nextInt();
	int inQ = nix.nextInt();
	int inR = nix.nextInt();
	int inS = nix.nextInt();
	int inT = nix.nextInt();
      System.out.println ();
      System.out.println ( "Entered Numbers are: " );
	  int [] inNum = new int [20];
	    inNum [0] = inA;
	    inNum [1] = inB;
	    inNum [2] = inC;
	    inNum [3] = inD;
	    inNum [4] = inE;
	    inNum [5] = inF;
	    inNum [6] = inG;
	    inNum [7] = inH;
	    inNum [8] = inI;
	    inNum [9] = inJ;
	    inNum [10] = inK;
	    inNum [11] = inL;
	    inNum [12] = inM;
	    inNum [13] = inN;
	    inNum [14] = inO;
	    inNum [15] = inP;
	    inNum [16] = inQ;
	    inNum [17] = inR;
	    inNum [18] = inS;
	    inNum [19] = inT;
      System.out.print ( inNum [0] + "  " );
      System.out.print ( inNum [1] + "  " );
      System.out.print ( inNum [2] + "  " );
      System.out.print ( inNum [3] + "  " );
      System.out.print ( inNum [4] + "  " );
      System.out.print ( inNum [5] + "  " );
      System.out.print ( inNum [6] + "  " );
      System.out.print ( inNum [7] + "  " );
      System.out.print ( inNum [8] + "  " );
      System.out.print ( inNum [9] + "  " );
      System.out.print ( inNum [10] + "  " );
      System.out.print ( inNum [11] + "  " );
      System.out.print ( inNum [12] + "  " );
      System.out.print ( inNum [13] + "  " );
      System.out.print ( inNum [14] + "  " );
      System.out.print ( inNum [15] + "  " );
      System.out.print ( inNum [16] + "  " );
      System.out.print ( inNum [17] + "  " );
      System.out.print ( inNum [18] + "  " );
      System.out.print ( inNum [19] );

      
  }
}

. . . that's what i've done so far, arranging the entered number. . . please give me a hint on how am i gonna do with the distinct numbers and how frequent they were entered . . . what statement will i use, please give me a clue . . .

You need to study how to use loops and arrays. Throw this code out and start over.
When you read the numbers entered by the user, you put each number into a separate element of the array, not into individual variables. As each number is entered you change the index to the array to reference the next element in the array. This can easily be done by using a for loop.

Go back to your text and tutorial and read about how to use arrays and loops.

use Array.length() to loop through the array ,
create a temporary variable to arrange (Sort) the numbers..!
you've created a garbage program try to create Array loop!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.