Home / Expert Answers / Computer Science / create-a-java-program-will-consist-of-two-files-app-java-the-main-application-class-unique-java-pa799

(Solved): Create a JAVA program will consist of two files App.java - the main application class Unique.java ...



Create a JAVA program will consist of two files

App.java - the main application class

Unique.java - class for retrieving the unique values from the user

Include documentation at the top of both files that includes

Your name

Date of development

Assignment (e.g. CIS218 Final Practical

Description of the class

The Unique class provides the following:

Constructor

Private member variable to store 5 unique values (hint: use an Array or an ArrayList)

Public function to get 5 unique values from the user and store them in the member variable

loop to get the numbers, if a number is already stored, ignore it and keep looping until you have 5 unique numbers

if a number is out of range, don't store the value, throw an exception and handle it in such a way that you don't break the loop but do message the user that the value was out of range

Public functions to return the following based on the stored values:

Largest number

Smallest number

Sum of all numbers

Average of the numbers entered

Last number entered divided by the first number entered

Hint: How you approach the ability to get the above values is up to you - you may process the stored values within each function, you may use private member variables to store the information as you retrieve it from the user, or you may use a combination of both techniques

The main application does the following

Print a line that states "Your Name - Final Practical"

Creates an instance of the Unique class

Calls the Unique class's getNumbers function to get the necessary values from the user

Calls the Unique class's function to print the following (each value with an appropriate label)

All unique values entered by the user

The largest number entered

The smallest number entered

The sum of all numbers entered

The average of all numbers entered

The last number entered divided by the first number entered (handle division by 0 exception properly)

Sample Output:

Your Name - Final Practical Exam
Please enter an integer value: 5
Please enter an integer value: 5
Please enter an integer va

Your Name - Final Practical Exam
Please enter an integer value: 0
Please enter an integer value: 45
Please enter an integer v

 

Your Name - Final Practical Exam Please enter an integer value: 5 Please enter an integer value: 5 Please enter an integer value: 5 Please enter an integer value: 5 Please enter an integer value: 5 Please enter an integer value: 5 Please enter an integer value: 5 Please enter an integer value: 5 Please enter an integer value: 5 Please enter an integer value: 2 Please enter an integer value: \( -1 \) java. lang. Exception: You must enter a value between \( \theta \) and 100 , inclusive. Please enter an integer value: 101 java. lang. Exception: You must enter a value between \( \theta \) and 100 , inclusive. Please enter an integer value: 6 Please enter an integer value: 42 Please enter an integer value: 38 Unique Values Entered: 5264238 Min Value Entered: 2 Max Value Entered: 42 Sum of Values Entered: 93 Average of Values Entered: 18 Last Value Divided by First Value: 7 All processing completed! Your Name - Final Practical Exam Please enter an integer value: 0 Please enter an integer value: 45 Please enter an integer value: 65 Please enter an integer value: 92 Please enter an integer value: 7 Unique Values Entered: 04565927 Min Value Entered: 0 Max Value Entered: 92 Sum of Values Entered: 209 Average of Values Entered: 41 java. lang.ArithmeticException: / by zero All processing completed!


We have an Answer from Expert

View Expert Answer

Expert Answer


Java program to store unique 5 values in list. import java.util.Scanner; import java.util.ArrayList; import java.util.Collections; /** * Unique */ pub
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe