Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class called Item. a. Item will need instance variables itemID, itemName, inStore, and Price (of types String, String, int and double accordingly). b.

Create a class called Item. a. Item will need instance variables itemID, itemName, inStore, and Price (of types String, String, int and double accordingly). b. Item will need appropriate methods and constructors. Make sure to have a toString() method that prints the item, making sure to format the float to 2 decimal places with $. b. Save the class as Student.java. 3. You are to create a class called TestItem and save it as TestItem.java. a. Make sure that you create an array called hardware. Add the items. itemID itemName inStore Price 1011 Air Filters 200 10.5 1034 Door Knobs 60 21.5 1101 Hammers 90 9.99 1600 Levels 80 19.99 1500 Ceiling Fans 100 59 1201 Wrench Sets 55 80

b. Create a method called printInventory() that traverses through the array and prints out each element.

c. Create a method called sortID() that sorts the array using itemID. You may choose to use sorting algorithm of your choice (e.g. Insertion, Selection, or Merge, but not the Bubble sort).

d. Create a method called sortName() that insertion sorts the array using itemName.

e. Create a method called sortInStore() that selection sorts the array using inStore.

f. Create a method called sortPrice() that merge sorts the array using price.

g. Test your methods similar to output shown below

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

Step: 3

blur-text-image

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

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

Question Can plan participants borrow from a VEBA?

Answered: 1 week ago

Question

Question What is an educational benefit trust and how is it used?

Answered: 1 week ago