I have all my code done, but it keeps saying no suitable constructor found (close to the bottom on the first code- ProduceInfo pInfo section- line 150) and cannot find symbol (line 62). I have read over this code, searched the errors on the net, and watched videos to try and figure it out. I would appreciate any help. Thank you in advance.

package farmersmarket3;

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

public class FarmersMarket3 {

    // creates item array
    
    static ProduceInfo[] produceItem = new ProduceInfo[0];
    /**
     * @param args the command line arguments
     */
    
    static int presentItem = 0;
    
    public static void main(String[] args) {
        
                      
        
       addProduceItem("Gene's Greenhouse", "Apples", 56987543, 36, 13.75);
       addProduceItem("Sue's One Stop", "Corn", 01120124, 64, 19.60);
       addProduceItem("Big Bills", "Strawberries", 22539874, 19, 26.99);
       addProduceItem("All Produce", "Tomatoes", 87765801, 53, 10.01);
       addProduceItem("Smith's", "Potatoes", 45663336, 42, 21.00);        
       addProduceItem("Diggin's Farm", "Watermelon", 52000251, 81, 6.77);               
        
       itemsSort();
       ProduceGUI prodGUI = new ProduceGUI();
       
    }
    public static double itemCost() {
       double cost = 0;
        
       for(int y = 0; y < produceItem.length; y++)
       {
          cost += produceItem[y].getTotal();
       }
               return cost;
    }
    
    public static void itemsSort() {
       
        ProduceInfo temporary;
        
        for (int presentItem = 0; presentItem < produceItem.length; presentItem++);
        {
            for (int i = presentItem + 1; i < produceItem.length; i++){
              String item0 = produceItem[presentItem].getItem();
              String item1 = produceItem[i].getItem();
              if (item0.compareTo(item1) > 0) {
                 temporary = produceItem[presentItem];
                 produceItem[presentItem] = produceItem[i];
                 produceItem[i] = temporary;
              }
            }
        }
    
    }
    
    public static String getPresentTotalString() {
       
        if (produceItem.length == 0) {
           return "No items:";
        
        }
        
        else {
           StringBuilder sb = new StringBuilder();
           
           Formatter formatter = new Formatter (sb, Locale.US);
           
           formatter.format(produceItem[presentItem].toString());
           formatter.format("\n");
           formatter.format("Total cost of items in stock: %s\n", NumberFormat.getCurrencyInstance().format(itemCost()));
           return sb.toString();
        
        }
    
    
    }
    
    public static void displayNext() {
       if (presentItem == produceItem.length - 1) {
          
           displayFirst();
       }
       else {
          
           presentItem++;
       }
    
    }
    
    public static void displayFirst() {
    
          presentItem = 0;
           
    }
    
     public static void displayFinal() {
    
           presentItem = produceItem.length - 1;
           
    }
     
     public static String[] getStringArray() {
      
       String[] presentStringArray = new String[5];
       presentStringArray[0] = produceItem[presentItem].getItem();
       presentStringArray[1] = produceItem[presentItem].getLocalMarket();
       presentStringArray[2] = Integer.toString(produceItem[presentItem].getSku());
       presentStringArray[3] = Integer.toString(produceItem[presentItem].getNumCases());
       presentStringArray[4] = Double.toString(produceItem[presentItem].getCasePrice());
       return presentStringArray;
     
     }
     
     public static int getNextProduceItem() {
     
        int newSku = 0;
         for (int y = 0; y < produceItem.length; y++){
         
            if (produceItem[y].getSku() > newSku) {
            
                   newSku = produceItem[y].getSku();
            }
         }
         
            return newSku +1;
     }
     
     public static void  addProduceItem(String localMarket, String item,
             int sku, int numCases, double casePrice) {
             
         String[] newFarmersMarket = new String[5];
         
         newFarmersMarket[0] = item;
         newFarmersMarket[1] = localMarket;
         newFarmersMarket[2] = Integer.toString(sku);
         newFarmersMarket[3] = Integer.toString(numCases);
         newFarmersMarket[4] = Double.toString(casePrice);                                                                                                           
         addFarmersMarket(newFarmersMarket);
     }
     
     public static void addFarmersMarket(String[] info) {
     
         ProduceInfo  pInfo = new ProduceInfo(getNextProduceItem(), info[0],info[1],
         Integer.valueOf(info[2]), Integer.valueOf(info[3]),Double.valueOf(info[4]));
        Class elementType = produceItem.getClass().getComponentType();
        ProduceInfo[] newArray = (ProduceInfo[]) 
       java.lang.reflect.Array.newInstance(elementType, produceItem.length +1);
        
        System.arraycopy(produceItem, 0 , newArray, 0 , produceItem.length);
        
        newArray [newArray.length - 1] = pInfo;
        
        produceItem =  newArray;
        displayFinal();
        displayFirst();
     }
     
      
}
package farmersmarket3;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;  
import java.awt.event.ActionListener;
/**
 *
 * @author Lynn
 */
class ProduceGUI implements ActionListener {
    
 static JPanel jplAdvanced;  
 
 static JPanel jplNavigation;
     
 static JButton jbnNext;
         
 static JLabel jlbLabel;
         
 static JFrame jfrMain;   
         
 static JTextArea jtxtArea;      
   
 
 public ProduceGUI() {
 
    jplAdvanced = new JPanel();
    
    jplNavigation = new JPanel();
    jlbLabel = new JLabel();
    jlbLabel.setText("Farmers Market Program");
    
    jfrMain = new JFrame("Market Inventory");
    jfrMain.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
    
    jtxtArea = new JTextArea();
    jtxtArea.append(FarmersMarket3.getPresentTotalString());
    jfrMain.getContentPane().add(jtxtArea);   
    
    jbnNext = new JButton("Next");
    jbnNext.addActionListener(this);
    jbnNext.setActionCommand("next");  
    
    jplAdvanced.add(jbnNext);
    
    jplNavigation.add(jlbLabel);
    
    jfrMain.pack();
    jfrMain.setVisible(true);
    
    jfrMain.getContentPane().add(jplNavigation, BorderLayout.PAGE_START);
    jfrMain.getContentPane().add(jtxtArea, BorderLayout.WEST);
    
    jfrMain.getContentPane().add(jplAdvanced, BorderLayout.PAGE_END);
 }
 
 private static void displayPresentTotal() {
    
    jtxtArea.setText(FarmersMarket3.getPresentTotal());
 }
 
 public static void enableButtons (boolean enable) {
 
    jbnNext.setEnabled(enable);
 }
 
 public void actionPerformed (ActionEvent e) {
 
    if ("next".equalsIgnoreCase(e.getActionCommand())) {
    
       FarmersMarket3.displayNext();
       displayPresentTotal();
    }
 }
}

The error in the code above is where it says displayPresentTotal. Thank you all once again.

it keeps saying no suitable constructor found

Please post the FULL text of the error message.

Please post the FULL text of the error message.

Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - no suitable constructor found for ProduceInfo(int,java.lang.String,java.lang.String,java.lang.Integer,java.lang.Integer,java.lang.Double)
constructor farmersmarket3.ProduceInfo.ProduceInfo(java.lang.String) is not applicable
(actual and formal argument lists differ in length)
constructor farmersmarket3.ProduceInfo.ProduceInfo(java.lang.String,int,int,double) is not applicable
(actual and formal argument lists differ in length)
constructor farmersmarket3.ProduceInfo.ProduceInfo(java.lang.String,java.lang.String,int,int,double) is not applicable
(actual and formal argument lists differ in length)
at farmersmarket3.FarmersMarket3.addFarmersMarket(FarmersMarket3.java:160)
at farmersmarket3.FarmersMarket3.addProduceItem(FarmersMarket3.java:155)
at farmersmarket3.FarmersMarket3.main(FarmersMarket3.java:33)
Java Result: 1

Where is the class definition for the ProduceInfo class?
The error messages say the definition for the class does NOT include several constructors that you are trying to use.

Where is the class definition for the ProduceInfo class?
The error messages say the definition for the class does NOT include several constructors that you are trying to use.

I have a total of 4 classes for this assignment, here is the ProduceInfo class:

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

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

/**
 *
 * @author Lynn
 */

// gets info from produce class to use
class ProduceInfo extends Produce3 {
    
    private String localMarket;
    
    public ProduceInfo (String localMarket, String item,  int sku, int numCases,
            double casePrice) {
       super(item, sku, numCases, casePrice);
       localMarket = localMarket;
    }
    
    public ProduceInfo (String item, int sku, int numCases, double casePrice) {
       super(item, sku, numCases, casePrice);
    
}
    
    public ProduceInfo(String item) {
       super(item);
    }

    /**
     * @return the localMarket
     */
    public String getLocalMarket() {
        return localMarket;
    }

    /**
     * @param localMarket the localMarket to set
     */
    public void setLocalMarket(String localMarket) {
        localMarket = localMarket;
    }
    
    public double getTotal() {
       return super.getTotal();
    }
    
    
    // addds 7% tax on purchses
    public double getTax() {
       return super.getTotal() * 0.07;
    }
    
    public String toString() {
       
        StringBuilder sb = new StringBuilder();
        
        // formats string builder to US currency
        Formatter formatter = new Formatter (sb, Locale.US);
        
            formatter.format("Item name: %s\n", getItem());
            formatter.format("SKU: %i\n", getSku());
            formatter.format("Number of cases: %i\n", getNumCases());
            formatter.format("Market: $%d\n", getLocalMarket());
            formatter.format("Price per case: $%d\n", 
            NumberFormat.getCurrencyInstance().format(getCasePrice()));
            formatter.format("Total cost is: $%d\n", 
            NumberFormat.getCurrencyInstance().format(getTotal()));
            formatter.format("Total Tax: $%d\n", 
            NumberFormat.getCurrencyInstance().format(getTax()));
            formatter.format("Total putchase cost with tax: $%d\n", 
            NumberFormat.getCurrencyInstance().format(getTotal() + getTax()));
            return sb.toString(); 
    
    }
}

Did you compare the constructors in the ProductInfo class with what the compiler was not able to find? Were the constructors it was looking for in the definition?

Did you compare the constructors in the ProductInfo class with what the compiler was not able to find? Were the constructors it was looking for in the definition?

I think I forgot the tax part?
I see that I have 3 integers- 2 strings, and a double. Now I need to find where it is getting the extra integer from.

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.