I had to reconstruct my program from the last time I had posted for help. My instructor enlightened me that I needed to follow her example to the tea, even though I had the same output that was required, I did not have all concepts required meet.

So, after spending two days getting the program back on track, I am now having a problem getting the array items to pass through my constructor and the result is null outputs. I have scanned the code so many times and can't see the error. If someone could take the time to thoroughly look over my main java doc and it's corresponding pages that hold my super classes and constructor for the array it would be greatly appreciated.

Page 1 main java doc.

import java.text.NumberFormat;
import java.util.Formatter;
import java.util.Locale;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Ashley Anderson
 */
public class sales {
    static dataFormat [] Data = new dataFormat [0];
    
    static int currentData = 0;
    
    
    public static void main (String args[]) 
   {
       //loading the array object
    addNewData("Fresh Farm","Lemon", 8, 10.78);
    addNewData("Dale Farm","Lettuce", 6, 8.99);
    addNewData("Star Farm","Tomato", 9, 12.95);
    addNewData("Apple Acers","Apple", 12, 12.55);
    addNewData("Orangeland Farms","Orange", 1, 14.99);
    
    dataSort();   
    
    ApplicationGUI appGui = new ApplicationGUI();
   }
    
    public static float inventoryValue(){
       float total = 0;
        for (int x = 0; x < Data.length; x++){
            total += Data[x].getSalesValue();
        }
        return total;
   }
    
    public static void dataSort() {
        
      dataFormat tmp1, tmp2;
   ;
      
                    for (int i=0; i <Data.length; i++){
			  for (i = currentData + 1; i< Data.length; i++){
                                 String s1 = Data[i-1].getName();
                                 String s2 = Data[i].getName();
				  if(s1.compareTo(s2) > 0)  {
                                          tmp1 = Data[i-1];
					  tmp2 = Data[i];					  Data[currentData] = Data[i];
					  Data[i] = tmp1;
                                          Data[i-1] = tmp2;
				  }
			  }
		 }
	}
   
    public static String getInventoryString (){
           
           StringBuilder sb = new StringBuilder();
           
           Formatter formatter = new Formatter(sb, Locale.US);
           
           for (int x = 0; x < Data.length; x++){
               formatter.format(Data[x].toString());
               formatter.format("\n");
           }
           formatter.format("Total Inventory Value: %s\n", NumberFormat.getCurrencyInstance().format(inventoryValue()));
           return sb.toString();
       }
    public static String getCurrentString(){
            if(Data.length == 0){
                return "No Data!";
                }else{
                StringBuilder sb = new StringBuilder();
                Formatter formatter = new Formatter(sb, Locale.US);
                
                formatter.format(Data[currentData].toString());
                formatter.format("\n");
                formatter.format("Total Inventory Value: %s\n", NumberFormat.getCurrencyInstance().format(inventoryValue()));
                return sb.toString();
               
        }
    }
       public static String[] getStringArray(){
        String[] currentStringArray = new String[4];
        currentStringArray[0] = Data[currentData].getName();
        currentStringArray[1] = Data[currentData].getFarm();
        currentStringArray[2] = Integer.toString(Data[currentData].getSold());
        currentStringArray[3] = Double.toString(Data[currentData].getPrice());
        return currentStringArray;
    }
    
       
    public static void showNext(){
           if (currentData == Data.length -1){
               showFirst();
          }else{
               currentData ++;
           }
       }

    public static void showLast() {
        currentData = Data.length -1;
    }

    public static void showFirst() {
        currentData = 0;
    }
    public static void searchData(String name){
        for(int searchData = 0; searchData < Data.length; searchData++) {
            if (name.compareToIgnoreCase(Data[searchData].getName())== 0){
                currentData = searchData;
                return;
            }
        }
           // ApplicationGUI.searchFailed();
    }
    
       public static void modifyData(String [] newData){
        Data[currentData].setName(newData[0]);
        Data[currentData].setName(newData[1]);
        Data[currentData].setSold(Integer.valueOf(newData[2]));
        Data[currentData].setPrice(Double.valueOf(newData[3]));
        dataSort();
    }  
       
       public static int getNextData(){
        int newCode = 0;
        for (int x = 0; x < Data.length; x++){
            if (Data[x].getNumSku() > newCode){
                newCode = Data[x].getNumSku();
            }
        }
        return newCode +1;
    }
 
    private static void addNewData(String name, String farm, int sold, double price) {
        String [] newData = new String [4];
        newData[0] = name;
        newData[1] = farm;
        newData[2] = Integer.toString(sold);
        newData[3] = Double.toString(price);
        
        addData(newData); //CALLS METHOD
        
    }

    public static void addData(String[] newData) {
        dataFormat iDataFormat = new dataFormat(getNextData(), newData[0], Integer.valueOf(newData[2]), Double.valueOf(newData[3]), newData[1]);
        Class elementType = Data.getClass().getComponentType();
        dataFormat[] newArray = (dataFormat[])java.lang.reflect.Array.newInstance(elementType, Data.length +1);
        System.arraycopy(Data, 0, newArray, 0, Data.length);
        
        newArray[newArray.length -1] = iDataFormat;
        
        Data = newArray;
        showLast();
        dataSort();
    }
    public static void deleteData(){
        int dataToDelete = currentData;
    
        Class elementType = Data.getClass().getComponentType();
        dataFormat[] newArray = (dataFormat[]) java.lang.reflect.Array.newInstance(elementType, Data.length -1);
        System.arraycopy(Data, 0, newArray, 0, dataToDelete);
        System.arraycopy(Data, dataToDelete+1, newArray, dataToDelete, Data.length - dataToDelete -1);
        Data = newArray;
        
        showPrevious();
        dataSort();
    }
    public static void saveData(){
        for(int x = 0; x < Data.length; x++){
            if (Data[x].saveData()){
            }else{
                ApplicationGUI.saveFailed();
                return;
            }
        }
                ApplicationGUI.saveSuccessful();
                return;
    }

    static int getDataSize() {
         return Data.length;
    }

    static void showPrevious() {
        if (currentData == 0){
            showLast();
        }else{
            currentData--;
        }
    }
    
}

Page two, original constructor for array and is inherited by the dataformat java doc.

/**
 *
 * @author Ashley
 */
public class Data {
        private int numSku;
	private String name;
	private int sold;
	private double price;
        
        public Data(int numSku, String name, int sold, double price){
            numSku = numSku;
            name = name;
            sold = sold;
            price = price;
        }
        public Data(String name){
            numSku = 0;
            name = name;
            sold = 0;
            price = 0;
        }
        public Data (){
            numSku = 0;
            name = "";
            sold = 0;
            price = 0;
        }

    /**
     * @return the numSku
     */
    public int getNumSku() {
        return numSku;
    }

    /**
     * @param numSku the numSku to set
     */
    public void setNumSku(int numSku) {
        this.numSku = numSku;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the sold
     */
    public int getSold() {
        return sold;
    }

    /**
     * @param sold the sold to set
     */
    public void setSold(int sold) {
        this.sold = sold;
    }

    /**
     * @return the price
     */
    public double getPrice() {
        return price;
    }

    /**
     * @param price the price to set
     */
    public void setPrice(double price) {
        this.price = price;
    }
    
    // calculation for sales value
    public double getSalesValue(){
        return price * sold;
    }
}

the dataformat java doc extends on data.java, it is unnecessary for it be this way but is required for the class.

class dataFormat extends Data{
    private String farm;

    dataFormat(int numSku, String name, Integer sold, Double price, String farm) {
        super(numSku, name, sold, price);
        farm = farm;
    }
    
    public dataFormat(String name){
        super(name);
    }
    public String getFarm(){
        return farm;
    }
    public void setFarm(String farm){
        farm = farm; 
    }
    @Override
    public double getSalesValue(){
        return super.getSalesValue();
    }
    public double getTax(){
        return super.getSalesValue() * 07;
    }
    
    public String toString() {
		StringBuilder sb = new StringBuilder();


		// Send all output to the Appendable object sb
		Formatter formatter = new Formatter(sb, Locale.US);

		// Explicit argument indices may be used to re-order output.
		formatter.format("Salesman Number: %d\n", getNumSku());
		formatter.format("Salesman Name: %s\n", getName());
		formatter.format("Department: %s\n", getFarm());
		formatter.format("Number of Widgets Sold: %d\n", getSold());
		formatter.format("Widget Price: %s\n", NumberFormat.getCurrencyInstance().format(getPrice()));
		formatter.format("Total Sales: %s\n", NumberFormat.getCurrencyInstance().format(getSalesValue()));
		formatter.format("Sales Bonus: %s\n", NumberFormat.getCurrencyInstance().format(getTax()));
		formatter.format("Total value plus Fee: %s\n", NumberFormat.getCurrencyInstance().format(getSalesValue() + getTax()));
		return sb.toString();
	}

	public Boolean saveData() {
		StringBuilder fileLine = new StringBuilder();
		FileWriter fstream = null;

		// Create file
		try {
			// Create the file if it doesn't exist, make the file appendable
			fstream = new FileWriter("c:\\data\\sales.dat", true);
		}
		catch (Exception e) {
			// Directory doesn't exist or some other error
			// Check if directory exists
			File file=new File("C:\\data");
			boolean exists = file.exists();
			// If not, create it or else we have some sort of other error, so quit
			if (!exists) {
				boolean success = (new File("C:\\data")).mkdir();
				// We the directory is created, try save again
				if (success) {
					return saveData();
				}
			}
			System.err.println("Error: " + e.getMessage());
			return false;
		}

		try {
			BufferedWriter out = new BufferedWriter(fstream);

			fileLine.append(String.valueOf(getNumSku()));
			fileLine.append(";");
			fileLine.append(getName());
			fileLine.append(";");
			fileLine.append(getFarm());
			fileLine.append(";");
			fileLine.append(String.valueOf(getSold()));
			fileLine.append(";");
			fileLine.append(String.valueOf(getPrice()));

			out.append(fileLine.toString());
			out.newLine();
			out.close();
		}
		catch (Exception e){//Catch exception if any
			System.err.println("Error: " + e.getMessage());
			return false;
		}
		return true;
	}


}

I'm sorry for you because of your instructor... I know that this course wouldn't teach you much because of her laziness... Also, many error prone techniques used in the class...

Let's get back to square one. There are 2 major problems I am seeing right now. One is that your Data class does not initiate an object properly and result in an empty object. The other is that your "numSku" which is passed into your dataFormat() constructor is always 1.

Even though I attempt to update your dataFormat constructor content from

super(numSku, name, sold, price);

to

super(numSku, name, sold.intValue(), price.doubleValue());

it still doesn't work. I will need to think about it. I'm really tired right now from work and it is late here. Will have to take another look tomorrow...

OK, I woke up this morning and remember something. I found the source of the problem. In your "Data" class constructor, variables are ambiguous. If it is originally from the instructor you took, she is really ....

// change it from...
  public Data(int numSku, String name, int sold, double price){
    numSku = numSku;
    name = name;
    sold = sold;
    price = price;
  }
  public Data(String name){
    numSku = 0;
    name = name;
    sold = 0;
    price = 0;
  }

// to
  public Data(int numSku, String name, int sold, double price){
    this.numSku = numSku;
    this.name = name;
    this.sold = sold;
    this.price = price;
  }
  public Data(String name){
    this.numSku = 0;
    this.name = name;
    this.sold = 0;
    this.price = 0;
  }

lol I"m gonna pm you a zipped file of her program just so you can see... it has been a strenuous class to say the least.

Ok let me try this and see how it ends up. Thanks a ton once again lol...

Ya ok so I can't send a file but ya my teacher is something else. She couldn't even help me debug a program. I would send her the error report and code. she tells us we need more information than that. yet I come here and post exactly the same crap and get help. anyway!!! that fixed the problem :) Thank you sooo much

ok i shouldn't speak so soon. I see some more issues. I am going to mess around with it and see where I get if I get stuck are you going to be around today that I might be able to bug you some more?

Don't need to worry about bugging. Anyone else on this forum is qualified to help you too. So please do not hesitate.

So it runs and compiles, but it is not sorting right. I wrote the dataSort trying to implement what you had shown me in my last thread. However I couldn't figure out how to implement the .add .remove from the way you declared the array to the way I have now. you used different syntax than the way I did. my declaration is array arrayname[] and yours used (). anyway, I was wondering if you could give me some insight as to the difference between them and how I can implement the dataSort to work properly with the same syntax already used.

I assume that you are talking about the "swap" part. It is actually much simpler than you thought.

// using array list is...
tmp1 = array.get(i);
tmp2 = array.get(i-1);
array.remove(i);
array.add(i, tmp2);
array.remove(i-1);
array.add(i-1, tmp1);

// in native array []
tmp = array[i];
array[i] = array[i-1];
array[i-1] = tmp;

Well I guess the problem isn't there then.

So, the program is suppose to: Display each array item one at a time in the GUI with first, last, previous, next, add, delete, modify, search, and save buttons. All my buttons appear to work. when you run the program the right item is appearing and is in the right sort order. when you hit the next button it goes to the next item, but it is trying to show more than one item and then it just stops. The buttons wont work after that. it's a lot of pages I can post them all but before I clutter up the forum let me know if you need to see them all if the main is enough to see the problem.

you might want the updated main doc.. here is the updated main with the sort fixed (i think)

import java.text.NumberFormat;
import java.util.Formatter;
import java.util.Locale;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Ashley 
 */
public class sales {
    static dataFormat [] Data = new dataFormat [0];
    
    static int currentData = 0;
    
    
    public static void main (String args[]) 
   {
       //loading the array object
    addNewData("Fresh Farm","Lemon", 8, 10.78);
    addNewData("Dale Farm","Lettuce", 6, 8.99);
    addNewData("Star Farm","Tomato", 9, 12.95);
    addNewData("Apple Acers","Apple", 12, 12.55);
    addNewData("Orangeland Farms","Orange", 1, 14.99);
    
    dataSort();   
    
    ApplicationGUI appGui = new ApplicationGUI();
   }
    
    public static float inventoryValue(){
       float total = 0;
        for (int x = 0; x < Data.length; x++){
            total += Data[x].getSalesValue();
        }
        return total;
   }
    
    public static void dataSort() {
        
      dataFormat tmp;
   
      
                    for (int i=0; i <Data.length; i++){
			  for (i = currentData + 1; i< Data.length; i++){
                                 String s1 = Data[i-1].getName();
                                 String s2 = Data[i].getName();
				  if(s1.compareTo(s2) > 0)  {
                                          tmp = Data[i];
					  Data[i] = Data[i-1];					  
                                          Data[i-1]=tmp;                                          
			  }
		 }
	}
    }
    public static String getInventoryString (){
           
           StringBuilder sb = new StringBuilder();
           
           Formatter formatter = new Formatter(sb, Locale.US);
           
           for (int x = 0; x < Data.length; x++){
               formatter.format(Data[x].toString());
               formatter.format("\n");
           }
           formatter.format("Total Inventory Value: %s\n", NumberFormat.getCurrencyInstance().format(inventoryValue()));
           return sb.toString();
       }
    public static String getCurrentString(){
            if(Data.length == 0){
                return "No Data!";
                }else{
                StringBuilder sb = new StringBuilder();
                Formatter formatter = new Formatter(sb, Locale.US);
                
                formatter.format(Data[currentData].toString());
                formatter.format("\n");
                formatter.format("Total Inventory Value: %s\n", NumberFormat.getCurrencyInstance().format(inventoryValue()));
                return sb.toString();
               
        }
    }
       public static String[] getStringArray(){
        String[] currentStringArray = new String[4];
        currentStringArray[0] = Data[currentData].getName();
        currentStringArray[1] = Data[currentData].getFarm();
        currentStringArray[2] = Integer.toString(Data[currentData].getSold());
        currentStringArray[3] = Double.toString(Data[currentData].getPrice());
        return currentStringArray;
    }
    
       
    public static void showNext(){
           if (currentData == Data.length -1){
               showFirst();
          }else{
               currentData ++;
           }
       }

    public static void showLast() {
        currentData = Data.length -1;
    }

    public static void showFirst() {
        currentData = 0;
    }
    public static void searchData(String name){
        for(int searchData = 0; searchData < Data.length; searchData++) {
            if (name.compareToIgnoreCase(Data[searchData].getName())== 0){
                currentData = searchData;
                return;
            }
        }
           // ApplicationGUI.searchFailed();
    }
    
       public static void modifyData(String [] newData){
        Data[currentData].setName(newData[0]);
        Data[currentData].setName(newData[1]);
        Data[currentData].setSold(Integer.valueOf(newData[2]));
        Data[currentData].setPrice(Double.valueOf(newData[3]));
        dataSort();
    }  
       
       public static int getNextData(){
        int newCode = 0;
        for (int x = 0; x < Data.length; x++){
            if (Data[x].getNumSku() > newCode){
                newCode = Data[x].getNumSku();
            }
        }
        return newCode +1;
    }
 
    private static void addNewData(String name, String farm, int sold, double price) {
        String [] newData = new String [4];
        newData[0] = name;
        newData[1] = farm;
        newData[2] = Integer.toString(sold);
        newData[3] = Double.toString(price);
        
        addData(newData); //CALLS METHOD
        
    }

    public static void addData(String[] newData) {
        dataFormat iDataFormat = new dataFormat(getNextData(), newData[0], Integer.valueOf(newData[2]), Double.valueOf(newData[3]), newData[1]);
        Class elementType = Data.getClass().getComponentType();
        dataFormat[] newArray = (dataFormat[])java.lang.reflect.Array.newInstance(elementType, Data.length +1);
        System.arraycopy(Data, 0, newArray, 0, Data.length);
        
        newArray[newArray.length -1] = iDataFormat;
        
        Data = newArray;
        showLast();
        dataSort();
    }
    public static void deleteData(){
        int dataToDelete = currentData;
    
        Class elementType = Data.getClass().getComponentType();
        dataFormat[] newArray = (dataFormat[]) java.lang.reflect.Array.newInstance(elementType, Data.length -1);
        System.arraycopy(Data, 0, newArray, 0, dataToDelete);
        System.arraycopy(Data, dataToDelete+1, newArray, dataToDelete, Data.length - dataToDelete -1);
        Data = newArray;
        
        showPrevious();
        dataSort();
    }
    public static void saveData(){
        for(int x = 0; x < Data.length; x++){
            if (Data[x].saveData()){
            }else{
                ApplicationGUI.saveFailed();
                return;
            }
        }
                ApplicationGUI.saveSuccessful();
                return;
    }

    static int getDataSize() {
         return Data.length;
    }

    static void showPrevious() {
        if (currentData == 0){
            showLast();
        }else{
            currentData--;
        }
    }
    
}

I hope. I don't have your GUI class, so I don't see what you are talking about. :P I only debug using System.out.println() method. No IDE used in my debugging (in any of my programming language) and I don't use one for debugging anyway. :P

ohh I dont know that that trick yet... here is the main GUI doc.

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;

/**
 *
 * @author esc1vbr
 */
class ApplicationGUI implements ActionListener
{
        static JFrame jfrMain;
	// Declare 4 buttons
	static JButton jbnFirst, jbnNext, jbnPrevious, jbnLast, jbnAdd, jbnDelete, jbnModify, jbnSearch, jbnSave;

	// Declare a panel to draw on
	static JPanel jplNavigation;

	// Declare Advanced panel for additional buttons
	static JPanel jplAdvanced;

	// Declare a text area
	static JTextArea jtxtArea;

	// Declare a Label
	static JLabel jlblLogo, jlbLabel;

	public ApplicationGUI(){
	    // Create and set up the window.
	    jfrMain = new JFrame("Farmers Market Program");
	    jfrMain.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

	    // Add the text area
	    jtxtArea = new JTextArea();
	    jtxtArea.append(sales.getCurrentString());
	    jfrMain.getContentPane().add(jtxtArea);

	    // Create Panel for buttons
	    jplNavigation = new JPanel();
            jlbLabel = new JLabel();
            jlbLabel.setText("Sales Receipt");

	    // Create Advanced panel for additional buttons
	    jplAdvanced = new JPanel();

	    // Create First button
	    jbnFirst = new JButton("First");
	    jbnFirst.addActionListener(this);
	    jbnFirst.setActionCommand("first");

	    // Create Previous button
	    jbnPrevious = new JButton("Previous");
	    jbnPrevious.addActionListener(this);
	    jbnPrevious.setActionCommand("previous");

	    // Create Next button
	    jbnNext = new JButton("Next");
	    jbnNext.addActionListener(this);
	    jbnNext.setActionCommand("next");

	    // Create Last button
	    jbnLast = new JButton("Last");
	    jbnLast.addActionListener(this);
	    jbnLast.setActionCommand("last");

	 // Create Add button
	    jbnAdd = new JButton("Add");
	    jbnAdd.addActionListener(this);
	    jbnAdd.setActionCommand("add");

	 // Create Delete button
	    jbnDelete = new JButton("Delete");
	    jbnDelete.addActionListener(this);
	    jbnDelete.setActionCommand("delete");

	 // Create Modify button
	    jbnModify = new JButton("Modify");
	    jbnModify.addActionListener(this);
	    jbnModify.setActionCommand("modify");

		 // Create Search button
	    jbnSearch = new JButton("Search");
	    jbnSearch.addActionListener(this);
	    jbnSearch.setActionCommand("search");

		 // Create Save button
	    jbnSave = new JButton("Save");
	    jbnSave.addActionListener(this);
	    jbnSave.setActionCommand("save");


	    // Add Title label to the panel
            jplNavigation.add(jlbLabel);


	    // Add buttons to Advanced Panel
            jplAdvanced.add(jbnFirst);
	    jplAdvanced.add(jbnPrevious);
	    jplAdvanced.add(jbnNext);
	    jplAdvanced.add(jbnLast);
	    jplAdvanced.add(jbnAdd);
	    jplAdvanced.add(jbnDelete);
	    jplAdvanced.add(jbnModify);
	    jplAdvanced.add(jbnSearch);
	    jplAdvanced.add(jbnSave);

	    // Create Logo
	    jlblLogo = new JLabel(createImageIcon("apples.png"));

	    // Add panel to frame
	    jfrMain.getContentPane().add(jplNavigation, BorderLayout.PAGE_START);
	    jfrMain.getContentPane().add(jtxtArea, BorderLayout.WEST);
	    jfrMain.getContentPane().add(jlblLogo, BorderLayout.EAST);

	    // Add Advanced panel to frame
	    jfrMain.getContentPane().add(jplAdvanced, BorderLayout.PAGE_END);

	    //Display the window.
	    jfrMain.pack();
	    jfrMain.setVisible(true);

	}

	private static void showCurrentData(){
		jtxtArea.setText(sales.getInventoryString());
	}

	private static ImageIcon createImageIcon(String fileName) {
		java.net.URL imgURL = ApplicationGUI.class.getResource(fileName);
		return new ImageIcon(imgURL);
	}

	public static void enableButtons(boolean enable) {
		jbnFirst.setEnabled(enable);
		jbnNext.setEnabled(enable);
		jbnPrevious.setEnabled(enable);
		jbnLast.setEnabled(enable);
		jbnDelete.setEnabled(enable);
		jbnModify.setEnabled(enable);
		jbnSearch.setEnabled(enable);
		jbnSave.setEnabled(enable);
		return;
	}

	@SuppressWarnings("static-access")
	@Override
	public void actionPerformed(ActionEvent e) {
		// Auto-generated method stub
		if ("first".equalsIgnoreCase(e.getActionCommand())) {
			sales.showFirst();
			showCurrentData();
		} else if ("previous".equalsIgnoreCase(e.getActionCommand())) {
                        sales.showPrevious();
			showCurrentData();
		} else if ("next".equalsIgnoreCase(e.getActionCommand())) {
			sales.showNext();
			showCurrentData();
		} else if ("last".equalsIgnoreCase(e.getActionCommand())) {
			sales.showLast();
			showCurrentData();
		} else if ("add".equalsIgnoreCase(e.getActionCommand())) {
	  	    AddDataGUI dialog = new AddDataGUI(this.jfrMain, true);
    		dialog.setSize(250, 120);
    	    dialog.setVisible(true);
    	    if (dialog.bOKPressed) {
    	    	sales.addData(dialog.getData());
    	    	showCurrentData();
    	    	enableButtons(true);
    	    }

		} else if ("delete".equalsIgnoreCase(e.getActionCommand())) {
	  	    DeleteGUI dialog = new DeleteGUI(ApplicationGUI.jfrMain, true);
                    dialog.setSize(250, 120);
                    dialog.setVisible(true);
                    if (dialog.bOKPressed) {
                    sales.deleteData();
                    showCurrentData();
                    if (sales.getDataSize() == 0) {
    	    		enableButtons(false);
    	    	}
    	    }

		} else if ("modify".equalsIgnoreCase(e.getActionCommand())) {
	  	    ModifyGUI dialog = new ModifyGUI(ApplicationGUI.jfrMain, true);
    		dialog.setSize(250, 120);
    	    dialog.setVisible(true);
    	    if (dialog.bOKPressed) {
    	    	sales.modifyData(dialog.getData());
    	    	showCurrentData();
    	    }

			// copy for all new classes
		} else if ("search".equalsIgnoreCase(e.getActionCommand())) {
	  	    SearchGUI dialog = new SearchGUI(ApplicationGUI.jfrMain, true);
    		dialog.setSize(250, 78);
    	    dialog.setVisible(true);
    	    if (dialog.bOKPressed) {
    	    	sales.searchData(dialog.getName());
    	    	showCurrentData();
    	    }

		} else if ("save".equalsIgnoreCase(e.getActionCommand())) {
	  	    SaveGUI dialog = new SaveGUI(ApplicationGUI.jfrMain, true);
    		dialog.setSize(250, 60);
    	    dialog.setVisible(true);
    	    if (dialog.bOKPressed) {
    	    	sales.saveData();
    	    	showCurrentData();
    	    }

		} else {
			// something is wrong
		}
	}

	public static void searchFailed() {
		JOptionPane.showMessageDialog(jfrMain, "Data not found");
		return;
	}

	public static void saveFailed() {
		JOptionPane.showMessageDialog(jfrMain, "Did not save data");
		return;
	}

	public static void saveSuccessful() {
		JOptionPane.showMessageDialog(jfrMain, "Save data");
		return;
	}

}

well I am certain that my problem lays with my dataSort method. here is what I got I added in a print line like you had done for me before and I can see its not sorting and my calculations are coming out wrong. here is the current code for the page that I believe the problem is. I am giving it a rest tonight hopefully I can get it finished by midnight tomorrow.

/**
 *
 * @author Ashley Anderson
 */
public class sales {
    static dataFormat [] Data = new dataFormat [0];
    
    static int currentData = 0;
    
    
    public static void main (String args[]) 
   {
       //loading the array object
    addNewData("Fresh Farm","Lemon", 8, 10.78);
    addNewData("Dale Farm","Lettuce", 6, 8.99);
    addNewData("Star Farm","Tomato", 9, 12.95);
    addNewData("Apple Acers","Apple", 12, 12.55);
    addNewData("Orangeland Farms","Orange", 1, 14.99);
    
    dataSort();   
    for (int i=0; i<Data.length; i++) {
      System.out.println(Data[i]);
    }
    
    ApplicationGUI appGui = new ApplicationGUI();
   }
    
    public static float inventoryValue(){
       float total = 0;
        for (int x = 0; x < Data.length; x++){
            total += Data[x].getSalesValue();
        }
        return total;
   }
    
    public static void dataSort() {
        
      dataFormat tmp;
   
      
                    for (int i=0; i <Data.length; i++){
			  for (i = currentData + 1; i< Data.length; i++){
                                 String s1 = Data[i-1].getName();
                                 String s2 = Data[i].getName();
				  if(s1.compareTo(s2) > 0)  {
                                          tmp = Data[i];
					  Data[i] = Data[i-1];					  
                                          Data[i-1]=tmp;                                          
			  }
		 }
	}
    }
    public static String getInventoryString (){
           
           StringBuilder sb = new StringBuilder();
           
           Formatter formatter = new Formatter(sb, Locale.US);
           
           for (int x = 0; x < Data.length; x++){
               formatter.format(Data[x].toString());
               formatter.format("\n");
           }
           formatter.format("Total Inventory Value: %s\n", NumberFormat.getCurrencyInstance().format(inventoryValue()));
           return sb.toString();
       }
    public static String getCurrentString(){
            if(Data.length == 0){
                return "No Data!";
                }else{
                StringBuilder sb = new StringBuilder();
                Formatter formatter = new Formatter(sb, Locale.US);
                
                formatter.format(Data[currentData].toString());
                formatter.format("\n");
                formatter.format("Total Inventory Value: %s\n", NumberFormat.getCurrencyInstance().format(inventoryValue()));
                return sb.toString();
               
        }
    }
       public static String[] getStringArray(){
        String[] currentStringArray = new String[4];
        currentStringArray[0] = Data[currentData].getName();
        currentStringArray[1] = Data[currentData].getFarm();
        currentStringArray[2] = Integer.toString(Data[currentData].getSold());
        currentStringArray[3] = Double.toString(Data[currentData].getPrice());
        return currentStringArray;
    }
    
       
    public static void showNext(){
           if (currentData == Data.length -1){
               showFirst();
          }else{
               currentData ++;
           }
       }

    public static void showLast() {
        currentData = Data.length -1;
    }

    public static void showFirst() {
        currentData = 0;
    }
    public static void searchData(String name){
        for(int searchData = 0; searchData < Data.length; searchData++) {
            if (name.compareToIgnoreCase(Data[searchData].getName())== 0){
                currentData = searchData;
                return;
            }
        }
           // ApplicationGUI.searchFailed();
    }
    
       public static void modifyData(String [] newData){
        Data[currentData].setName(newData[0]);
        Data[currentData].setName(newData[1]);
        Data[currentData].setSold(Integer.valueOf(newData[2]));
        Data[currentData].setPrice(Double.valueOf(newData[3]));
        dataSort();
    }  
       
       public static int getNextData(){
        int newCode = 0;
        for (int x = 0; x < Data.length; x++){
            if (Data[x].getNumSku() > newCode){
                newCode = Data[x].getNumSku();
            }
        }
        return newCode +1;
    }
 
    private static void addNewData(String name, String farm, int sold, double price) {
        String [] newData = new String [4];
        newData[0] = name;
        newData[1] = farm;
        newData[2] = Integer.toString(sold);
        newData[3] = Double.toString(price);
        
        addData(newData); //CALLS METHOD
        
    }

    public static void addData(String[] newData) {
        dataFormat iDataFormat = new dataFormat(getNextData(), newData[0], Integer.valueOf(newData[2]), Double.valueOf(newData[3]), newData[1]);
        Class elementType = Data.getClass().getComponentType();
        dataFormat[] newArray = (dataFormat[])java.lang.reflect.Array.newInstance(elementType, Data.length +1);
        System.arraycopy(Data, 0, newArray, 0, Data.length);
        
        newArray[newArray.length -1] = iDataFormat;
        
        Data = newArray;
        showLast();
        dataSort();
    }
    public static void deleteData(){
        int dataToDelete = currentData;
    
        Class elementType = Data.getClass().getComponentType();
        dataFormat[] newArray = (dataFormat[]) java.lang.reflect.Array.newInstance(elementType, Data.length -1);
        System.arraycopy(Data, 0, newArray, 0, dataToDelete);
        System.arraycopy(Data, dataToDelete+1, newArray, dataToDelete, Data.length - dataToDelete -1);
        Data = newArray;
        
        showPrevious();
        dataSort();
    }
    public static void saveData(){
        for(int x = 0; x < Data.length; x++){
            if (Data[x].saveData()){
            }else{
                ApplicationGUI.saveFailed();
                return;
            }
        }
                ApplicationGUI.saveSuccessful();
                return;
    }

    static int getDataSize() {
         return Data.length;
    }

    static void showPrevious() {
        if (currentData == 0){
            showLast();
        }else{
            currentData--;
        }
    }
    
}

Look at your for-loop inside the dataSort(). It should be...

dataFormat tmp;
      for (int i=0; i <Data.length; i++){
        for (int j = i + 1; j< Data.length; j++){
          if(Data[j-1].getName().compareTo(Data[j].getName()) > 0)  {
            tmp = Data[j];
            Data[j] = Data[j-1];
            Data[j-1] = tmp;
          }
        }
      }
    }

Because you keep using "i" variable in both 2 loops & you assign "currentData" variable which has nothing to do with the loop to the initial value, your sort doesn't really do anything.

What I ended up doing is using the program that you helped me with two weeks ago and adding in all the elements. I still had a minor output issue but it meet all requirements for the assignment. Thanks for all the help :) you can close the thread.

You are welcome.

By the way, I cannot close the thread because I am not the threat creator. You can mark it as solved to display that it does not need further discussion. :)

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.