Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is all written in Java. This is the Grading Rubric. Instructions: Let's pull together all your knowledge of sorting algorithms and use them in
This is all written in Java.
This is the Grading Rubric.
Instructions: Let's pull together all your knowledge of sorting algorithms and use them in a project. Imagine you work in a store and have been asked to keep an inventory of the products for sale. Different people have requested that you sort the list and print it in various ways. You can do that and will do so using each of the different sorting algorithms. 1. Create new project called 10.07 Assignment in your Module 10 Assignment folder. 2. Create an implementation class to define an item in your store. a. Establish instance variables for the item's name, product number, price, and quantity currently in the store. b. Setup a constructor for an item that will initialize all the instance variables. c. Create appropriate methods including a toString method, making sure to format the cost to include the dollar sign and precision to two decimal places. d. Add any additional attributes or behaviors you feel are appropriate. (optional) 3. For this project, you will create a tester class that declares an array for the products in your inventory and makes use methods to sort the data. 4. Declare an array of at least 10 products. Of course, be sure to use school-appropriate items. For example: Chewbacca Mask, 1281, 19.99, 24 5. Design a static method that traverses through the array and prints each element in a table format. 6. Create the following static methods in the tester class. Using each sorting algorithm at least once, you may choose when to employ the insertion, selection, or merge sort. Use each at least once. Sorts using insertion or selection must have the option for ascending or descending order. The merge sort will sort only in ascending order. a. a method that sorts the array by the product number b. a method that sorts the array by the product's name c. a method that sorts the array by the item's price d. a method that sorts the array by the product quantity 7. Test your sorting methods by calling each and displaying the results. Start by showing the array without sorting. Then demonstrate each of the sorts you created. The output should be in a table format. Be sure to clearly label your output so someone looking at it knows which sort was applied each time. 10.07 Challenge Program Grading Rubric Points Possible Points Earned Components Comments include for name, date, and purpose of the program. 1 An implementation class for an inventory product that includes instance variables, a constructor, and appropriate methods including toString. 4 A tester class with an array of the products in the store's inventory. 3 A method to print all the objects in the array. 1 A method to sort by the product number. 4. A method to sort by the product's name. 4 A method to sort by the price of the product. 4. A method to sort by the quantity of product currently in the store. 4. Sort methods invoked and run properly for ascending and descending order. 1 Output is clearly labeled, formatted, and accurate. 2 No compiler errors. No runtime errors. 1
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