I can only get 2 of the buttons to work - what am I doing wrong?
I have been working on this for 5 days.
I also cannot get my icon to work - do I need more of an address?
import java.util.ArrayList; //For ArrayList
public class Product implements Comparable<Product>
{
//=======================================Private Variables===============================
private String name; //Product name
private String type; //Product type
private int identificationNumber; //Product identification number
private int unitsInStock; //Product number units in stock
private double unitPriceInDollars; //Product price of each per unit in dollars
//=========================================Constructors==================================
//Default constructor
public Product()
{
//Do nothing
//NOTE: Strings get set to null, int to 0, and double to 0.0
}//End Product default constructor
//Initialization constructor with type
public Product(
String nameIn, String typeIn, int identificationNumberIn,
int unitsInStockIn, double unitPriceInDollarsIn
)
{
//Use the set methods to enforce bounds checking
setName( nameIn );
setType( typeIn );
setIdentificationNumber( identificationNumberIn );
setUnitsInStock( unitsInStockIn );
setUnitPriceInDollars( unitPriceInDollarsIn );
}//End Product initialization constructor
//Copy Constructor
public Product( Product productIn )
{
//Use the set methods to enforce bounds checking
setName( productIn.getName() );
setType( productIn.getType() );
setIdentificationNumber( productIn.getIdentificationNumber() );
setUnitsInStock( productIn.getUnitsInStock() );
setUnitPriceInDollars( productIn.getUnitPriceInDollars() );
}//End copy constructor Product
//=======================================Public Methods==================================
//----------------------------------------Set Methods------------------------------------
//Stores the item name
public void setName( String nameIn )
{
name = nameIn;
}//End method setName
//Stores the Product type
public void setType( String typeIn )
{
type = typeIn;
}//End method setType
//Stores the Product identification number
public void setIdentificationNumber( int identificationNumberIn )
{
// If the value is negative, then store 0
identificationNumber = ( ( identificationNumberIn > 0 ) ? identificationNumberIn : 0 );
}//End method setIdentificationNumber
//Stores the Product number of units in stock
public void setUnitsInStock( int unitsInStockIn )
{
// If the value is negative, then store 0
unitsInStock = ( ( unitsInStockIn > 0 ) ? unitsInStockIn : 0 );
}//End methodsetUnitsInStock
//Stores the unit price in dollars (the price per unit) of each Product
public void setUnitPriceInDollars( double unitPriceInDollarsIn )
{
// If the value is negative, then store 0.0
unitPriceInDollars = ( ( unitPriceInDollarsIn > 0.0 ) ? unitPriceInDollarsIn : 0.0 );
}//End method setUnitPriceInDollars
//A method to overwrite this Product with another
public void set( Product productIn )
{
//Set the Product name--use the set methods to enforce bounds checking
setName( productIn.getName() );
//Set the Product type--use the set methods to enforce bounds checking
setType( productIn.getType() );
//Set the Product identification number
setIdentificationNumber( productIn.getIdentificationNumber() );
//Set the Product number of units in stock
setUnitsInStock( productIn.getUnitsInStock() );
//Set the Product unit price in dollars
setUnitPriceInDollars( productIn.getUnitPriceInDollars() );
}//End method set
//----------------------------------------Get Methods------------------------------------
//Returns the Product name
public String getName()
{
return ( name );
}//End method getName
//Returns the Product type
public String getType()
{
return ( type );
}//End method getType
//Returns the Product identification number
public int getIdentificationNumber()
{
return ( identificationNumber );
}//End getIdentificationNumber
//Returns the Product number of units in stock
public int getUnitsInStock()
{
return( unitsInStock );
}//End method getUnitsInStock
//Returns the Product unit price (price of one unit)
public double getUnitPriceInDollars()
{
return( unitPriceInDollars );
}//End method getUnitPriceInDollars
//----------------------------------------Calculations-----------------------------------
//Calculates the stock value for one (this) Product in dollars
// NOTE: I don't call this a 'get' method because I reserve that name for methods that
// retrieve private variables
public double stockValueInDollars()
{
return ( unitsInStock * unitPriceInDollars );
}//End method stockValueInDollars
//Calculates and returns the total value of an array of Products
public static double totalInventoryValue( Product inventory[] )
{
double inventoryValue = 0.0;
for ( Product product : inventory )
{
//Add the total value of this product to the total value of the inventory
inventoryValue += product.stockValueInDollars();
}//End enhanced for
return ( inventoryValue ); //Return the value of the inventory
}//End method totalValue
//Calculates and returns the total value of an ArrayList of Products
// I just include this for possible future versions that use an ArrayList
// instead of an array
// You can safely leave this out of your program
public static double totalInventoryValue( ArrayList<Product> inventory )
{
double inventoryValue = 0.0;
for ( Product product : inventory )
{
//Add the stock value of this Product to the total
inventoryValue += product.stockValueInDollars();
}//End enhanced for
return ( inventoryValue ); //Return the value of the inventory
}//End method totalInventoryValue
//----------------------------------------Sorting----------------------------------
//Overloads the compareTo() method so Products can be compared and
// potentially sorted by name using Arrays.sort
public int compareTo( Product anObject )
{
String s2 = anObject.name.toUpperCase();
String s1 = this.name.toUpperCase();
return ( s1.compareTo(s2) );
}//End method compareTo
//Sorts the Product array by name
// This is an example of how to sort an array using a Bubble Sort Algorithm
public static void sortAlphabetical( Product inventory[] )
{
Product temp; //For swapping
int bottom;
int i;
//This is called a bubble sort
for(bottom = inventory.length-1;bottom > 0;bottom--)
{
for(i = 0; i < bottom; i++)
{
//If inventory[i]'s name is lexographically greater than
// inventory[i+1]'s name, then swap the two
if ( ( inventory[i].getName() ).compareTo( inventory[i+1].getName() ) > 0 )
{
//Swap inventory[i] with inventory[i+1]
temp = inventory[i];
inventory[i] = inventory[i+1];
inventory[i+1] = temp;
}//End if
}//End for
}//End for
}//End method sortAlphabetical
//-----------------------------------------Display----------------------------------
//Returns a formatted String that can be used to print to screen or file
public String toString()
{
//NOTE: The numbers before a decimal point set the field width and the minus
// sign left justifies the output in the field. The numbers after the
// decimal point set the number of digits to display after the decimal point.
String formatString = "%3d %8d %9.2f %9.2f %-8s %-20s";
return (
String.format(
formatString, identificationNumber, unitsInStock,
unitPriceInDollars, stockValueInDollars(),type, name
)
);
}//End method toString()
//Produce a nice display for a Product array
public static void listArray( Product inventory[] )
{
String headings;
System.out.println( "--------------------------------------------------------------" );
//Create the column headings
headings = String.format(
"%-3s %-8s %-20s %8s %9s %9s",
"ID#",
"TYPE",
"NAME",
"AMOUNT",
"PRICE($)",
"TOTAL($)"
);
//Create the column headings
headings = String.format(
"%3s %8s %9s %9s %-8s %-20s",
"ID#",
"AMOUNT",
"PRICE($)",
"VALUE($)",
"TYPE",
"NAME"
);
//Print the column headings to the screen
System.out.println( headings );
System.out.println( "--------------------------------------------------------------" );
//Use an enhanced for loop to print the toString() for each Product p in
// the Product array
for( Product p : inventory )
{
System.out.println( p.toString() );
}//End for
System.out.println( "--------------------------------------------------------------" );
//System.out.printf("Total Inventory Value: %39.2f\n", totalInventoryValue( inventory ) );
System.out.printf("Total Inventory Value: %9.2f\n", totalInventoryValue( inventory ) );
System.out.println( "--------------------------------------------------------------" );
}//End method listArray
//Returns a formatted String for output purposes
//NOTE: This is my old way of displaying things and can be disregarded
public String display()
{
String formatString = "Identification Number : %d\n";
formatString += "Product Name : %s\n";
formatString += "Product Type : %s\n";
formatString += "Units In Stock : %d\n";
formatString += "Unit Price : $%.2f\n";
formatString += "Stock Value : $%.2f\n\n";
return (
String.format(
formatString, identificationNumber, name, unitsInStock,
unitPriceInDollars, stockValueInDollars()
)
);
}//End toString()
}//End class Product
Criterion
Points
The application compiles and runs.
10
The application uses buttons to allow the user to move to the first item in the inventory, the previous item,
the next item, and the last item in the inventory.
10
The application properly allows the user to move to the last item when the first item is displayed and the previous button
is selected, and to move to the first item when the last item is displayed and the next button is selected.
10
The GUI includes a company logo.
10
The source code is readable and well documented.
10
Total
50
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*; //For java.awt.
import java.util.Arrays;
public class Inventory5 extends JFrame
{
//=======================================Private Variables===============================
//The private data
private DVD [] dvd; //The inventory -- an array of DVDs
private int index; //An index for keep track of the DVD to display
//Panels
private JPanel logoPanel; //Panel for placing the logo label
private JPanel fieldPanel; //Panel for placing the JTextFields and their JLabels
private JPanel mainPanel; //Panel for placing the main JButtons
//Labels
private JLabel logoLabel; //Label for displaying the logo
private JLabel nameLabel; //Label for the product name
private JLabel idLabel; //Label for the product id
private JLabel ratingLabel; //Label for the DVD rating
private JLabel unitsLabel; //Label for the units in stock
private JLabel priceLabel; //Label for the price
private JLabel valueLabel; //Label for the stock value
private JLabel feeLabel; //Label for the restocking fee
private JLabel totalLabel; //Label for the total value of the inventory
//Text Fields
private JTextField nameText; //Field for displaying/editing the product name
private JTextField idText; //Field for displaying/editing the product id
private JTextField ratingText; //Field for displaying/editing the DVD rating
private JTextField unitsText; //Field for displaying/editing the units in stock
private JTextField priceText; //Field for displaying/editing the DVD price
private JTextField valueText; //Field for displaying/editing the DVD stock value
private JTextField feeText; //Field for displaying/editing the DVD restocking fee
private JTextField totalText; //Field for displaying/editing the total inventory value
//Navigation Buttons
private JButton firstButton; //Button for moving to the first element in the array
private JButton nextButton; //Button for moving to the next element in the array
private JButton previousButton; //Button for moving to the next element in the array
private JButton lastButton; //Button for moving to the first element in the array
//Constatnts
private final static int FRAME_GRID_ROWS = 3;
private final static int FRAME_GRID_COLS = 1;
private final static int FIELD_PANEL_ROWS = 10;
private final static int FIELD_PANEL_COLS = 2;
private final static int MAIN_PANEL_ROWS = 1;
private final static int MAIN_PANEL_COLS = 4;
private final static String EMPTY_ARRAY_MESSAGE = "Hit ADD to add a new DVD";
private final static int FRAME_WIDTH = 350;
private final static int FRAME_LENGTH = 300;
private final static int FRAME_XLOC = 250;
private final static int FRAME_YLOC = 100;
//=========================================Constructors==================================
//Initialization constructor
// Starts the GUI with a DVD array passed by the user, but ensures unique identification numbers
public Inventory5( DVD dvdIn[] )
{
//Pass the frame title to JFrame and set the IconImage as well
//Joe's DVD Inventory
super( "Joe's DVD Inventory" );
//Set the input array equal to the private array variable
dvd = dvdIn;
//Sort the array
Arrays.sort( dvd );
//Always start the display at the first element of the array
index = 0;
//Build the GUI
buildGUI();
//Give it some values
updateAllTextFields();
}
//=================================Set/Update/Other Methods================================
//A method for updating each of the GUI fields
private void updateAllTextFields()
{
if ( dvd.length > 0 ) //The update the TextField display
{
//Update the product name text field
nameText.setText( dvd[index].getName() );
//Update the product id text field
idText.setText( String.format( "%d", dvd[index].getIdentificationNumber() ) );
//Update the rating text field
ratingText.setText( dvd[index].getRating() );
//Update the units in stock text field
unitsText.setText( String.format( "%d", dvd[index].getUnitsInStock() ) );
//Update the price text field
priceText.setText( String.format( "$%.2f" , dvd[index].getUnitPriceInDollars() ));
//Update the stock value text field
valueText.setText( String.format( "$%.2f" , dvd[index].stockValueInDollars() ));
//Update the restocking fee text field
feeText.setText( String.format( "$%.2f" , dvd[index].restockingFee() ));
//Update the total value text field
totalText.setText( String.format( "$%.2f" , Product.totalInventoryValue( dvd ) ));
}//End if
else //Put a special message in the fields
{
//Update the product name text field
nameText.setText( EMPTY_ARRAY_MESSAGE );
//Update the product id text field
idText.setText( EMPTY_ARRAY_MESSAGE );
//Update the rating text field
ratingText.setText( EMPTY_ARRAY_MESSAGE );
//Update the units in stock text field
unitsText.setText( EMPTY_ARRAY_MESSAGE );
//Update the price text field
priceText.setText( EMPTY_ARRAY_MESSAGE );
//Update the stock value text field
valueText.setText( EMPTY_ARRAY_MESSAGE );
//Update the restocking fee text field
feeText.setText( EMPTY_ARRAY_MESSAGE );
//Update the total value text field
totalText.setText( EMPTY_ARRAY_MESSAGE );
}//End else
}//End updateAllTextFields
//Update the display for the calculated fields
private void updateCalculatedFields()
{
//Update the stock value text field
valueText.setText( String.format( "$%.2f" , dvd[index].stockValueInDollars() ));
//Update the restocking fee text field
feeText.setText( String.format( "$%.2f" , dvd[index].restockingFee() ));
//Update the total value text field
totalText.setText( String.format( "$%.2f" , Product.totalInventoryValue( dvd ) ));
}//End updateCalculatedFields
//Set the appropriate fields editable or uneditable
private void setModifiableTextFieldsEnabled( Boolean state )
{
//The DVD name, ID, rating, units in stock, and price can all be set editable or uneditable
nameText.setEditable( state );
ratingText.setEditable( state );
unitsText.setEditable( state );
priceText.setEditable( state );
}//End setModifiableTextFieldsEnabled
//==========================Button and Text Handlers and Methods===========================
//-------------------------Button Handler Class and Handling Methods-----------------------
//The handler for handling the events for the buttons
private class ButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent event)
{
if( event.getSource() == firstButton ) //|<<| pressed
{
handleFirstButton();
}//End if
else if( event.getSource() == previousButton ) //|< | pressed
{
handlePreviousButton();
}//End else if
else if( event.getSource() == nextButton ) //| >| pressed
{
handleNextButton();
}//End else if
else if( event.getSource() == lastButton ) //|>>| pressed
{
handleLastButton();
}//End else if
}//End method actionPerformed
}//End class ButtonHandler
//Display the first element of the DVD array
private void handleFirstButton()
{
//Set the index to the first element in the array
index = 0;
//Update and disable modification
updateAllTextFields();
setModifiableTextFieldsEnabled( false );
}//End method handleFirstButton
//Display the previous element of the DVD array or wrap to the last
private void handlePreviousButton()
{
//Decrement the index
index--;
//If index is less than 0, wrap around to the last element of the array
if ( index < 0 )
{
index = dvd.length - 1;
}//End if
//Update and disable modification
updateAllTextFields();
setModifiableTextFieldsEnabled( false );
}//End method handlePreviousButton
//Display the previous element of the DVD array or wrap to the last
private void handleNextButton()
{
//Decrement the index
index--;
//If index is less than 0, wrap around to the last element of the array
if ( index < 0)
{
index = dvd.length + 1;
}//End if
//Update and disable modification
updateAllTextFields();
setModifiableTextFieldsEnabled( false );
}//End method handleNextButton
//Display the previous element of the DVD array or wrap to the last
private void handleLastButton()
{
//Decrement the index
index--;
//If index is less than 0, wrap around to the last element of the array
if ( index < 0)
{
index = dvd.length - 1;
}//End if
//Update and disable modification
updateAllTextFields();
setModifiableTextFieldsEnabled( false );
}//End method handleLastButton
//===================================GUI Building Methods==================================
//Build the GUI
private void buildGUI()
{
//Make a grid for the panels
setLayout( new GridLayout( FRAME_GRID_ROWS, FRAME_GRID_COLS ) );
//Add the logo
buildLogo();
//Add the text fields, their labels, and the SEARCH line
buildFields();
//Add the navigation and other buttons
buildMainButtons();
//Set some of the frame properties
setSize( 350 , 570 );
setLocation( FRAME_XLOC , FRAME_YLOC );
pack();
setResizable( false );
setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
setVisible( true );
}//End buildGUI()
//Add the logo to the JFrame
private void buildLogo()
{
//Create the panel on which to place the logo
logoPanel = new JPanel();
logoPanel.setLayout( new GridLayout( 1, 1 ) );
//Create the logo
logoLabel = new JLabel( "travelbug.gif" );
//Add the logo to the panel
logoPanel.add( logoLabel );
//Add the panel to the frame
add( logoPanel );
}//End method buildLogo
//Add the text fields, their labels, and the SEARCH line
private void buildFields()
{
//Create the panel on which to place the labels and text fields
fieldPanel = new JPanel();
fieldPanel.setLayout( new GridLayout( FIELD_PANEL_ROWS, FIELD_PANEL_COLS ) );
//Declare a handler for the buttons
ButtonHandler buttonHandler = new ButtonHandler();
//Create the name label
nameLabel = new JLabel( "Name: " );
nameLabel.setLabelFor( nameText );
fieldPanel.add( nameLabel );
//Create the name text field
nameText = new JTextField( "NONE" );
nameText.setEditable( false );
fieldPanel.add( nameText );
//Create the id label
idLabel = new JLabel( "ID: " );
idLabel.setLabelFor( idText );
fieldPanel.add( idLabel );
//Create the id text field
idText = new JTextField( "0" );
idText.setEditable( false );
fieldPanel.add( idText );
//Create the rating label
ratingLabel = new JLabel( "Rating: " );
ratingLabel.setLabelFor( ratingText );
fieldPanel.add( ratingLabel );
//Create the rating text field
ratingText = new JTextField( "" );
ratingText.setEditable( false );
fieldPanel.add( ratingText );
//Create the units in stock label
unitsLabel = new JLabel( "Units in Stock: " );
unitsLabel.setLabelFor( unitsText );
fieldPanel.add( unitsLabel );
//Create the units in stock text field
unitsText = new JTextField( "" );
unitsText.setEditable( false );
fieldPanel.add( unitsText );
//Create the unit price label
priceLabel = new JLabel( "Unit Price: " );
priceLabel.setLabelFor( priceText );
fieldPanel.add( priceLabel );
//Create the unit price text field
priceText = new JTextField( "" );
priceText.setEditable( false );
fieldPanel.add( priceText );
//Create the stock value label
valueLabel = new JLabel( "Unit Stock Value: " );
valueLabel.setLabelFor( valueText );
fieldPanel.add( valueLabel );
//Create the stock value text field
valueText = new JTextField( "" );
valueText.setEditable( false );
fieldPanel.add( valueText );
//Create the restocking fee label
feeLabel = new JLabel( "Restocking Fee: " );
feeLabel.setLabelFor( feeText );
fieldPanel.add( feeLabel );
//Create the restocking fee text field
feeText = new JTextField( "" );
feeText.setEditable( false );
fieldPanel.add( feeText );
//Add two labels that create a space between the other fields and the total inventory value field
fieldPanel.add( new JLabel( " " ) );
fieldPanel.add( new JLabel( " " ) );
//Create the total inventory value label
totalLabel = new JLabel( "Total Inventory Value: " );
totalLabel.setLabelFor( totalText );
fieldPanel.add( totalLabel );
//Create the total inventory value text field
totalText = new JTextField( "" );
totalText.setEditable( false );
fieldPanel.add( totalText );
//Add two labels that create a space between the total inventory value field and the search line
fieldPanel.add( new JLabel( " " ) );
fieldPanel.add( new JLabel( " " ) );
//Add the panel to the frame
add( fieldPanel );
}//End buildFields
//Add the main buttons to the frame
private void buildMainButtons()
{
//Create the JPanel for the main buttons
mainPanel = new JPanel();
mainPanel.setLayout( new GridLayout( MAIN_PANEL_ROWS, MAIN_PANEL_COLS ) );
//Create the FIRST (<<) button
firstButton = new JButton( "<<" );
firstButton.addActionListener( new ButtonHandler() );
mainPanel.add( firstButton );
//Create the PREVIOUS (<) button
previousButton = new JButton( "< " );
previousButton.addActionListener( new ButtonHandler() );
mainPanel.add( previousButton );
//Create the NEXT (>) button
nextButton = new JButton( ">" );
nextButton.setEnabled( false );
nextButton.addActionListener( new ButtonHandler() );
mainPanel.add( nextButton );
//Create the LAST (>>) button
lastButton = new JButton( ">>" );
lastButton.setEnabled( false );
lastButton.addActionListener( new ButtonHandler() );
mainPanel.add( lastButton );
//Add the main button panel to the frame
add( mainPanel );
}//End method buildMainButtons
//===================================Main Method==================================
//Provide a main method for generating the GUI
public static void main( String args[] )
{
//Create some sample DVDs
DVD myDVD[] = new DVD[4];
myDVD[0] = new DVD( "Matrix, The" , "R" , 1, 8, 9.99 );
myDVD[1] = new DVD( "Princess Bride, The", "PG" , 2, 12, 9.99 );
myDVD[2] = new DVD( "Ghandi", "PG" , 3, 3, 19.99 );
myDVD[3] = new DVD( "Cool Hand Luke", "NR" , 4, 4, 6.49 );
Inventory5 gui = new Inventory5( myDVD );
}
} //End class Inventory5
public class DVD extends Product
{
//=======================================Private Variables===============================
private String rating;
//=========================================Constructors==================================
//Initialization constructor
public DVD(String nameIn, String ratingIn, int identificationNumberIn, int unitsInStockIn,
double unitPriceInDollarsIn )
{
//Call the super class constructor
//NOTE: The Product type remains the same for all DVD sub-class objects: DVD
super(nameIn, "DVD", identificationNumberIn, unitsInStockIn, unitPriceInDollarsIn);
//Call the set method to ensure proper initialization
setRating( ratingIn );
}//End DVD constructor
//Copy constructor
public DVD( DVD anotherDVD )
{
//Call the super class constructor
super(
anotherDVD.getName(), anotherDVD.getType(), anotherDVD.getIdentificationNumber(),
anotherDVD.getUnitsInStock(), anotherDVD.getUnitPriceInDollars()
);
//Call the set method to ensure proper initialization
setRating( anotherDVD.getRating() );
}//End DVD constructor
//=======================================Public Methods==================================
//----------------------------------------Set Methods------------------------------------
//Store the DVD rating
public void setRating( String ratingIn )
{
rating = ratingIn;
}//End method setRating
//A method to overwrite this DVD with another
public void set( DVD dvdIn )
{
//Set the item name--use the set methods to enforce bounds checking
super.setName( dvdIn.getName() );
//Set the item identification number
super.setIdentificationNumber( dvdIn.getIdentificationNumber() );
//Set the number of units in stock
super.setUnitsInStock( dvdIn.getUnitsInStock() );
//Set the unit price in dollars
super.setUnitPriceInDollars( dvdIn.getUnitPriceInDollars() );
//Set the rating
setRating( dvdIn.getRating() );
}//End method set
//----------------------------------------Get Methods------------------------------------
//Return the DVD rating
public String getRating()
{
return ( rating ); //Return the DVD rating
}//End method getRating
//----------------------------------------Other Methods----------------------------------
//--------------------------------Calculate the stock value--------------------------------
//Returns the total value of product in stock for one product, including a 5% mark-up
// fee
public double stockValueInDollars()
{
//Add and return a 5% mark-up fee beyond the product value determined by the
// super class
return ( super.stockValueInDollars()*(1.0 + 0.05) );
} // End valueInDollars
//Returns the restocking fee
//Added 10/01/06
public double restockingFee()
{
return( super.stockValueInDollars()*0.05 );
}
//------------------------------------------Display-----------------------------------------
//Returns a formatted String for output purposes
public String toString()
{
String formatString;
//Create a formatted string
formatString = String.format(
" %-7s %-9.2f",
rating,
restockingFee()
);
//Return the string for use in display
return( super.toString() + formatString );
}//End toString()
//Produce a nice display for a Product array
public static void listArray( DVD inventory[] )
{
String headings;
System.out.println( "-------------------------------------------------------------------------------" );
//Create the column headings
headings = String.format(
"%3s %8s %9s %9s %-8s %-20s %-7s %-9s",
"ID#",
"AMOUNT",
"PRICE($)",
"VALUE($)",
"TYPE",
"NAME",
"RATING",
"MARK-UP"
);
//Print the column headings to the screen
System.out.println( headings );
System.out.println( "-------------------------------------------------------------------------------" );
//Use an enhanced for loop to print the toString() for each Product p in
// the Product array
for( DVD p : inventory )
{
System.out.print( p.toString() );
}//End for
System.out.println( "-------------------------------------------------------------------------------" );
System.out.printf("Total Inventory Value: %9.2f\n", totalInventoryValue( inventory ) );
System.out.println( "-------------------------------------------------------------------------------" );
}//End method listArray
}//End class DVD
any help wouild be greatly appreciated!
-bigbluesky