Question: Please write a Java application program that will accept a list of integers (up to 20) from the user into an array, and then show

 Please write a Java application program that will accept a list

Please write a Java application program that will accept a list of integers (up to 20) from the user into an array, and then show those numbers in ascending order (after being sorted by your sort method), the largest integer, the smallest integer, the sum of all integers, and the average of all integers. You may show the average by an integer or double floating-point number. Then, your program allows the user to search for a number in the list. If the number is in the list, please show its position in the list, otherwise please say the number is not found. Please stop the search game if the user enters -1. Then, you continue to accept another list of integers (up to 20) from the user. Please stop your program with a thank-you message if the user enters zero. Please see the sample test below to design your application program properly. This program is like a game of sorting and searching for users to play. This is an application of a single-dimensional array. You must use a single-dimensional array for this program. You must write a sort method to sort the integers in the array. You may use any sorting technique to sort the numbers. You must write a search method to search for the number requested by the user. Please use binary search instead of sequential search technique because the array has been sorted already by your sorting method. The following is a sample test, which must be your test case #1. You must also do test case #2 and test case #3 with different set of data. Each test case must accept at least two lists of integers from the user, and must search at least 3 numbers for each list. Welcome to play this wonderful number searching game! Please enter how many integers you would like to play (up to 20, 0 to stop) > 5 Please enter 5 integers in any order> 2 5 3 4 1 Your 5 integers in ascending order are: 1 2 3 4 5 The largest integer is 5, the smallest integer is 1, the sum of all integers is 15, & the average is 3 Please enter a number to search (-1 to end the search) > 4 The number 4 is found at the position 4 Please enter a number to search (-1 to end the search)> 44 The number 44 is not found. Please enter a number to search (-1 to end the search)>1 The number 1 is found at the position 1 Please enter a number to search (-1 to end the search)> -1 Please enter how many integers you would like to play (up to 20.0 to stop) > 6 Please enter 6 integers in any order> 9 20 5 3 34 18 Your 6 integers in ascending order are: 3 5918 20 34 The largest integer is 34, the smallest integer is 3, the sum of all integers is 89, & the average is 14 Please enter a number to search (-1 to end the search)> 34 The number 34 is found at the position 6 Please enter a number to search (-1 to end the search)>19 The number 19 is not found. Please enter a number to search (-1 to end the search)>3 The number 3 is found at the position 1 Please enter a number to search (-1 to end the search)> 20 The number 20 is found at the position 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!