Question: Please enter the following code into a Java file. Run the program to confirm it works as expected. Then, expand the program to do the

 Please enter the following code into a Java file. Run theprogram to confirm it works as expected. Then, expand the program to

Please enter the following code into a Java file. Run the program to confirm it works as expected. Then, expand the program to do the following steps in order. For each test, display the result of the test to the console. 1.1. Test to see if the unsorted set contains the value 10. 1.2. Test to see if the sorted set contains the value 5 . 1.3. Remove the element 10 from the unsorted set. 1.4. Test to see if the unsorted set still contains the value 10. 1.5. Add the value 8 to the sorted set. 1.6. Test to see if the sorted set contains the value 8 . 1.7. Display the unsorted set. 1.8. Display the sorted set. (The sorted set should now have two more values than the unsorted set.) 1.9. Add all values from the sorted set to the unsorted set by calling unsortedSet.addAll(sortedSet). 1.10. Display both sets and confirm they have the same contents, just in a different order. Sample program output follows. Your code must use the values listed above, even if they differ from the sample output. Does the unsorted set contain 10? true Does the sorted set contain 5? false Removing 10 from unsorted set. Does the unsorted set contain 10? false Adding 5 to sorted set. Does the sorted set contain 5? true The unsorted set is: [34,22,60,30] The sorted set is: [5,10,22,30,34,60] Adding all from sorted set to unsorted set. The unsorted set is: [34,5,22,10,60,30] The sorted set is: [5,10,22,30,34,60]

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!