Subject Computer Science Java Programming

Question

The Assignment
Design a class OrderedSet to manipulate ordered sets. The elements of an OrderedSet object are distinct and in ascending order. Note that the insert method must output an appropriate message if the element to be inserted is already in the list.Use the OrderedSet class to write a GUI application to keep track of a hardware store’s inventory. The store sells various items. For each item in the store, the following information is kept: item ID, item name, number of pieces in the store, and theselling price. The store manager wants to see the following reports:
•all records in ascending or descending order of item ID, based on a user selection (you may use a radio button)
•maximum price and a list of items with that price
•the total selling value for all items in the store.

Your program should read an input text file containing the items(Hint: use JFileChooser class to get the name of the input file). The format of the input file is as follows:
noOfItems

itemID    itemName    quantity    sellingPrice
itemID    itemName    quantity    sellingPrice
.
.
.
The first line indicates the number of items. The items’ data is given thereafter. A sample input file follows:
2
1111       Circular Saw       12    125.99
2222       Cooking Range    7    1129.99
.
.
.

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

* Application class
* @version 2.0
*/
public class Application extends JFrame {

/**
*
*/
private static final long serialVersionUID = 1L;

/*
* Constructor
* @throws FileNotFoundException
*/
public Application() throws FileNotFoundException {
JFileChooser chooser = new JFileChooser(".");
chooser.showOpenDialog(this);

// build OrderedSet from file
OrderedSet items = parseFile(chooser.getSelectedFile());

// headers for the table
String[] columns = new String[] { "Item ID", "Item Name", "Quantity", "Selling Price" };

// actual data for the table in a 2d array
Object[][] data = items.get2DArray();

// create table with data
JTable table = new JTable(data, columns);

// add the table to the frame
JScrollPane scrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
this.add(scrollPane, BorderLayout.CENTER);


// add top panel to the frame
JPanel panelTop = new JPanel...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Assisting Tutor
Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats