More specific question about my topic...

public class Item implements Comparable

{

private int myId;

private int myInv;

public Item(int id, int inv)

{

myId = id;

myInv = inv;

}

public int getId(){ )

public int getInv(){ }

public int compareTo(Object otherObject){ }

public boolean equals(Object otherObject){ }

public String toString(){ }

}

public class Store

{

private Item[] myStore;

public Store(String fileName) { }

public void displayStore()

public String toString(){ }

public void doSort() { }

private void quickSort(Item[] list, int first, int last)

private void loadFile(String inFileName)

}

The first line of file50.txt contains the number of id/inventory integer pairs listed on subsequent lines. The idea behind the data type item is the simulation of an item in a store, nearly all of which use a bar code for identification purposes. For every item in a store we keep track of an id value and an inventory amount. So file50.txt looks like this:

50

3679 87

196 60

17914 12

18618 64

2370 65

... ...

etc. (for 45 more lines)

Each id value in file50.txt will be unique.

Assignment:

Write a program that solves the following sequential events:

loads the data file, file50.txt, as a collection of Item types maintained in a Store object

sorts the data using quickSort

prints the data , now in increasing order based on the id field of an Item object

The printing should add a blank line after every 10 items in the output. Include a line number in the output. For example:

Id Inv

1 184 14

2 196 60

3 206 31

4 584 85

5 768 85

6 2370 65

7 3433 5

8 3679 87

9 4329 64

10 5529 11

11 6265 58

12 6835 94

13 6992 76

14 7282 73

15 8303 90

16 9267 68

I really have no Idea what to put for getId(), getInv(), and

the constructor Store

public Store(String fileName) { }

?

please.. please help me..

[2138 byte] By [DeathMomenta] at [2007-10-2 9:50:00]
# 1
Stick to the original thread, and don't crosspost. http://forum.java.sun.com/thread.jspa?threadID=699397
jverda at 2007-7-16 23:55:12 > top of Java-index,Java Essentials,New To Java...