Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions

Question

What are some architectural power system considerations?

Answered: 1 week ago