Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problems: The ABC Company typically uses an object of the SortingUtility class to sort products. A product has at least three attributes: ID , name
Problems:
The ABC Company typically uses an object of the SortingUtility class to sort products. A product has at least three attributes: ID name and price. All are accessible through their corresponding get method but the ID is fixed once set.
The SortingUtility class implements two private sorting algorithms, bubbleSort and quickSort, each of which takes the list of products and returns an ordered list of products. The SortingUtility class also has a public method List sortList items, int sortingApproachwhich simply calls the specified sorting approach ie bubbleSort or quickSort to return a list of sorted products to its client. Lets now assume that the SortingUtility works and is in use by some client programs.
However, one problem is that the SortingUtility currently does not log the list of sorted products before returning it to the client. Now the ABC Company would like to have an improved sorting service that can log for this lab, simply printing to the display console the list of sorted products before returning it to the client. To implement this improved service you can introduce another class but you cannot change the existing SortingUtility class for compatible reason except that you may need to relate it to a super class or an interface Moreover, the returned products from bubbleSort should be logged printed with ID followed by name and price, whereas the returned products from the quicksort should be logged printed with name first followed by ID and price.
pts What design pattern can be used? Document your patternbased design in UML class diagram, ensure attributes, methods, visibility, arguments and relationships are correctly included.
pts Implement your patternbased design in Java. Implement two test scenarios: one using quicksort to sort a list of products such as books, bags, and buttons, another using bubblesort to sort the same list of products.
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