Write a Java program that takes ten integers from the user and
construct the following methods:
1. Write a method that displays the ten integers.
2. Write a method that calculates the average of the ten numbers and
displays the result.
3. Write a method that returns the max and min numbers.
4. Write a method that finds the maximum value in a range between
the 3
rd number and the 8th number and print it. Note, the 3
rd
number and the 8th number are included in the range.
5. Write a method that finds the duplicate values within the ten
integers. If any duplicate value is found, display it. If there are no
duplicate elements, write the statement “Your numbers are
unique”.
6. Write a method that sorts the ten numbers and displays the result.
7. Implement the insertion sort method (mentioned in the lecture).
Use the method to insert a new number in the middle of the sorted
ten numbers (you already sorted them in step 6).
التعليقات