Here is my code for a working program that I need to sort the output by the DVD's Title

//

import java.util.*;
import java.text.*;
import java.io.*;


public class InventoryApp2 {

public static void main(String args []) 
{
Scanner input = new Scanner(System.in);		

		// Set the size of the array based on user input
		System.out.println( "Please enter the number of DVD's to record: " );
		int numDVD = input.nextInt();

		//Create employee array to store data
		DVDRuntime[] dvd = new DVDRuntime[numDVD];
		
			
		for (int i=0; i<numDVD; i++)
		{
                    
                    input = new Scanner(System.in);

                    // input the DVD Title
                    System.out.println( "\n\nPlease enter the Title for DVD # " + (i + 1) +": " );
                    String dvdTitle = input.nextLine();

                    // Input the DVD's item number
                    System.out.println( "\nPlease enter the item number for \nDVD # " + (i + 1) +": " );
                    int dvdItem = input.nextInt();

                    // Input the DVD's quantity on hand
                    System.out.println( "\nPlease enter the quantity on hand for DVD # " + (i + 1) +": " );
                    int dvdStock = input.nextInt();

                    // Input the Price for the DVD
                    System.out.println( "\nPlease enter the price for DVD # " + (i + 1) +": " );
                    double dvdPrice = input.nextDouble();

                    dvd[i] = new DVDRuntime(dvdItem, dvdTitle, dvdStock, dvdPrice);
                    
					//Input the Run-time for the DVD
					System.out.println("\nPlease enter runtime length of the DVD in minutes: ");
                    dvd[i].setRuntime(input.nextDouble());
		}
		
		//Print DVD data
                double totalInventoryValue=0;
                for (int i=0; i<numDVD; i++)
				
		{
		
			System.out.println(dvd[i]);
                        System.out.println("Runtime length: "+dvd[i].getRuntime() +" Minutes");
                        System.out.println("Value of this title stock: "+dvd[i].getTotal());
                        //clculating total value of inventory
                        totalInventoryValue += dvd[i].getTotal();
		}
                System.out.println("\nTotal value of inventory: "+totalInventoryValue);
                System.out.println("\nTotal value of inventory with 5% restocking fee: "+
					(totalInventoryValue*1.05));

} //end main

} // end class Inventory2

and

//

import java.util.*;
import java.text.*;
import java.io.*;

public class DVD 
{
	private int dvdItem;
	private String dvdTitle;
	private int dvdStock;
	private double dvdPrice;
	private double getTotal;

	public DVD(int item, String title, int stock, double price) 
	{
	dvdItem = item;
	dvdTitle = title;
	dvdStock = stock;
	dvdPrice = price;
	
	} //end four-argument constructor

	//default constructor
        public DVD(){}
	// set DVD Item
	public void setDvdItem(int item) {
	this.dvdItem = item;
	} //end method set Dvd Item

	//return DVD Item
	public int getDvdItem() {
	return dvdItem;
	} //end method get Dvd Item

	//set DVD Title
	public void setDvdTitle(String title) {
	this.dvdTitle = title;
	} //end method set Dvd Title

	//return Dvd Title
	public String getDvdTitle() {
	return dvdTitle;
	} //end method get Dvd Title

	public void setDvdStock(int stock) {
	this.dvdStock = stock;
	} //end method set Dvd Stock

	//return dvd Stock
	public int getDvdStock() {
	return dvdStock;
	} //end method get Dvd Stock

	public void setDvdPrice(double price) {
	this.dvdPrice = price;
	} //end method setdvdPrice

	//return DVD Price
	public double getDvdPrice() {
	return dvdPrice;
	} //end method get Dvd Price
	
	public double getTotal(){
	return dvdPrice*dvdStock;
	}

	
	public String toString() 
	{
	
	

		return ("\n" + "Title: " + this.dvdTitle + "\n"
			+ "Stock Number: " + this.dvdItem + "\n"
			+ "Quantity on hand: " + this.dvdStock +"\n" 
			+ "Price per unit: " + this.dvdPrice );
                        
	}

} //end class DVD

and

//

public class DVDRuntime extends DVD{

    double runtime;

    public double getRuntime() {
        return runtime;
    }

    public void setRuntime(double runtime) {
        this.runtime = runtime;
    }
    //defualt constructor
    public DVDRuntime(){}

    //parameterized
    public DVDRuntime(int item, String title, int stock, double price)
    {
        super( item,  title,  stock,  price);
    }
}

thanks

Yes, the arrays utility would be fine also. I have read many samples on different sites, but the all demonstrate it with programmer defined data. I could really use some help in figuring out where to place it and what syntax to use within the context of my program.

You create a Comparitor that implements the methods compare and equals. You pass it as the second argument to the Arrays.sort() static method (the array of DVD is the first arg). That's it. The two methods use the titles for the comparison.
Comparitor: (templated): http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/
Arrays: (templated): http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/util/Arrays.html#sort%28T[],%20java.util.Comparator%29

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.