Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I really need some help with this question. I dont even Know where to start! The

ID: 3871762 • Letter: I

Question

I really need some help with this question. I dont even Know where to start!

The code must be in C#, and must be VERY easy to read as I am a beginner.

The code must be a windows form/ GUI

DIrections below

---------------------------------------------------------------

(Duplicate Elimination) Use a one-dimensional array to solve the following problem:
Write an application that inputs five numbers, each of which is between 10 and 100, inclusive.
As each number is read, display it only if it’s not a duplicate of a number already read. Provide for the “worst case,” in which all five numbers are different.
Use the smallest possible array to solve this problem.
Display the complete set of unique values input after the user inputs each new value.

Use validation.
Use GUI for input and output. Design is yours

----------------------------------------------------------------------

Thanks for your help!!!

Explanation / Answer

import java.util.Arrays;
import java.util.Scanner;

public class DuplicateElimination {

    static void printUnique(int[] array) {
        int i;
        Arrays.sort(array);
        for (i = 1; i < array.length; i++) {
            if (array[i] != array[i - 1]) {
                System.out.print(array[i - 1] + " ");
            }
        }
        System.out.print(array[i - 1]);
    }

    public static void main(String[] args) {
        int[] array = new int[5];
        int temp;
        Scanner input = new Scanner(System.in);
        System.out.println("Enter any 5 digit between 10 to 100");
        for (int i = 0; i < array.length; i++) {
            do {
                System.out.println("Enter element " + (i + 1) + " :");
                temp = input.nextInt();
                if (temp >= 10 && temp <= 100)
                    array[i] = temp;
                else
                    System.out.println("Entered Invalid number");
            } while (temp < 10 || temp > 100);
        }
        System.out.print(" Unique Elements are :");
        printUnique(array);
    }
}