Objective:

The Objective of this lab was to create a program that analyze data . This program will have some functions asking the user to input the amount of numbers s/he wants to enter, then another function will ask for the numbers he wants. Finally the output will display the number entered, the number in reverse form and ascending form. Also will display the numbers she/ he entered.

Code:

package lab8;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Stack;
import java.util.TreeSet;
import java.util.List;
import java.util.Collections; 

public class lab8 {
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner input = new Scanner(System.in);
		Stack num0 = new Stack();
		LinkedList num1 = new LinkedList();
		LinkedList num2 = new LinkedList();
		TreeSet num3 = new TreeSet();

		int b = 0;
		int f = 0; 

		System.out.print("Input amount of Numbers: ");
		f = input.nextInt(); 

		while(b < f)
		{
			System.out.print("Enter your numbers: ");
			Integer num = input.nextInt();

			num1.addFirst(num);
			num0.push(num);
			num3.add(num);

			b++; 
		}

		num2.addAll(num1);
		Collections.sort(num2);

		System.out.printf("Numbers entered in reverse order:%s\n",num1);
        System.out.printf("Numbers entered in order:%s\n",num0);
		System.out.printf("Numbers entered in ascending order:%s\n",num2);
		System.out.printf("Number entered:%s\n",num3);

	}

}

 Screenshot: