Reference no: EM133914882
Homework
The goal of this homework is for you to construct a Java application that will prompt the user for input, store that input in an array, sort the inputted data, and output the sorted data on screen. This will be accomplished using the built-in Java libraries. (Later in the course you will write the sorting algorithm yourself.) These instructions are very specific, which reflects real-world customer requirements, so please follow them carefully.
Below in the editing window you can see a line that reads "Type your code below this line. Create additional lines as needed." All your code will go below that line, but before the first line with the comment "do not delete this line". Based on the Unit 1 Learning Activities, follow the steps below to construct your program:
Part I: Arrays and Variables
1. Create the Scanner variable with the following code: Scanner input = new Scanner(System.in);
2. Create an array named "nums", with a datatype of Integer (int) and a size of 3.
Part II: Input and User Prompts
1. Prompt the user with the following text (exactly): Input a number between 6 and 10
2. Store the user's input in the first position of the nums array (index 0).
3. Prompt the user with the following text: Input a number between 11 and 15
4. Store the user's input in the second position of the nums array (index 1).
5. Prompt the user with the following text: Input a number between 1 and 5
6. Store the user's input in the third position of the nums array (index 2).
Part III: Confirmation
Confirm the user's data by displaying it on the screen in the following way, with the appropriate user data displayed after the colon on each line:
Displaying unsorted array:
First number entered:
Second number entered:
Third number entered:
Part IV: Sorting the Array
i. Inform the user of what you are doing with the following message: "Sorting numbers...". Get the instant assignment help.
ii. Sort the array using the sort method built into the Arrays class with this code: Arrays.sort(nums);
Part V: Output
Display the user's data on the screen in the following way, with the appropriate data values displayed after the colon on each line:
Displaying sorted array:
Lowest number:
Middle number:
Highest number: