Question: Create a list class implemented using an array named ListArray that provides the following methods: ListArray() Constructs a list using an array with 10 elements.

Create a list class implemented using an array named ListArray that provides the following methods:

ListArray()

Constructs a list using an array with 10 elements.

ListArray( int capacity )

Constructs a list using an array with capacity elements.

void add( E item )

Add item to the list

int find( E target )

Find target in the list

If found, return the index (relative 0)

If not found, return -1

Note: The find() method should use equals() method to compare generic objects as done by the Java ArrayList class.

E get( int index )

Return object E at position index in list

If index out of bounds, return null

Thoroughly test all of the methods with a simple test class before using the array list to complete the assignment. Once the ListArray class has been successfully tested, proceed with developing the application below.

Develop a client program Prog2.java that maintains a list of parts. The program should begin by reading the parts.txt file, creating Part object, and storing the Part objects in a ListArray data structure.

parts.txt file: CSV (comma separated value) text file in which each line in the file represents parts in a warehouse. The comma delimited fields are:

Fields

Description

Part Number

5 characters

Description

maximum 30 characters

Price

double

Warehouse ID

3 characters

Quantity

Integer, quantity at this warehouse

After the ListArray data structure is filled, print a report listing the parts in an easy to read tabular format. Then, ask the user for a part number and display the part information using the find() and get() methods of the ListArray

csv file

12345,Left-Handed Bacon Stretcher,125.95,PGH,2 24680,Smoke Shifter,0.98,PGH,48 86420, Pre-dug Post Hole,2.49,ATL,34 25632,Acme Widget,98.29,LOU,342 97531,Anti-Gravity Turbine,895.29,ATL,3 24680,Battery-Powered Battery Charger,252.98,ATL,2 12345,Left-Handed Bacon Stretcher,125.95,LOU,35 97531,Anti-Gravity Turbine,895.29,PHL,8 00000,Glass Hammer,105.90,PGH,8 01020,Inflatable Dartboard,32.95,PGH,453 86420, Pre-dug Post Hole, 2.49,LOU,68 86420, Pre-dug Post Hole, 2.49,PGH,124 24680, Battery-Powered Battery Charger, 252.98, PHL, 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!