Part 1

Use a 1-D array to solve the following problem: Write an application that asks the user to input five numbers, each 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.

Part 2

Re-write the program above, this time using a collection class derived from Set (e.g. HashSet). As you will have discovered in yourResearch, sets handle duplicates differently from arrays, so your program's algorithm may be quite different using a set.

Part 3

Write a Java program to read and process a text file. The name of the text file is entered by the user. If the file does not exist, the program displays an error message and exits. Otherwise, the file is opened and read, keeping a count of the number of lines and total number of characters. These two values are displayed in a message box after the whole file has been read. After use, the file is closed. (Note that words are simply considered to be any text that is separated by spaces.)

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.