Question
Intro JAVA class very basic understanding and basic functions Use a one-dimensional array to solve the following problem: Write an application that inputs five numbers,
Intro JAVA class very basic understanding and basic functions 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 is 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.
You should have a class called Unique.java, which contains most of the code.
You should have a class called UniqueTest.java, which contains main(). The code for UniqueTest.java is:
Some hints:
1. Initialize the integer array numbers to hold five elements. This is the maximum number of values the program must store if all values input are unique.
2. Remember to validate the input and display an error message if the user inputs invalid data.
3. If the number entered is not unique, display a message to the user; otherwise, store the number in the array and display the list of unique numbers entered so far.
4. Remember to comment your code, because this is part of the grade.
A sample output might look like this:
I/ Lab 1: UniqueTest.java 2 // Test application for class Unique 3 public class UniqueTest public static void main String args[]) Unique application new Unique(); application.getNumbersO; 8 9 // end main I0 I end class UniqueTestStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started