Question
XYZ Company uses the service provided by an obtained object of Utility class to sort elements of type T. The default constructor of the Utility
XYZ Company uses the service provided by an obtained object of Utility
The two current sorting algorithms cannot print the sorted result but only return the sorted list for objects of type T. The XYZ Company now demands this printing feature to have add-ons for the two existing algorithms and possibly new algorithms as well. To prevent troubles, the goal is not to modify the algorithm code, not to change the relationship between XYZ, and not to update the existing Utility class. Moreover, the add-ons for each algorithm should allow the printing features in its own way. The bubblesort will print ID, name and price on a row in order, while the quicksort will print price, name and then ID in a different order.
(5 pts) There are three necessary interfaces and classes: XYZ, Utility, and ProductIF. Feel free to add more, so that a suitable Utility object can be used by XYZ to meet the sorting needs. Show your UML class diagram design and ensure attributes, methods, visibility, arguments and relationships are correctly included.
(5 pts) Implement code in C#. Demonstrate the execution for the following scenarios. XYZ gets a suitable Utility object. XYZ utilizes that object to run quicksort for a list of four desks (Desk for type T) with prices like 20.30, 15.25, 25.13, and 5.85. Hint: IComparable interface may be useful. Feel free to take advantage of already developed sorting algorithms.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started