Please! WHY? Why does the main class cannot find symbol symbol : constructor Car(double) location: class Car?

Why does the main class cannot find symbol symbol : constructor Car(double) location:
class Car .. ??
class Car
{ //variable declaration
double milesStart; double milesEnd; double gallons;
//constructors
public Car(double start, double end, double gall)
{ milesStart = start; milesEnd = end; gallons = gall; }
void fillUp(double milesE, double gall)
{ milesEnd = milesE; gallons = gall; }
//methods
double calculateMPG()
{ return (milesEnd - milesStart)/gallons; }
boolean gashog() { if(calculateMPG()<15) { return true; } else { return false; } }
boolean economycar() { if(calculateMPG()>30) { return true; } else { return false; } } }
import java.util.*; class MilesPerGallon
{ public static void main(String[] args)
     double milesS, milesE, gallonsU;
     Scanner scan = new Scanner(System.in);
     System.out.println(\"New car odometer reading: 00000\");
      Car car = new Car(milesS); car.fillUp(milesE, gallonsU);
     System.out.println(\"New Miles: \" + milesE); milesE = scan.nextDouble();
     System.out.println(\"Gallons used: \" + gallonsU);
     gallonsU = scan.nextDouble();
     System.out.println( \"MPG: \" + car.calculateMPG() );
     if(car.gashog()==true) { System.out.println(\"Gas Hog!\");
      if(car.economycar()==true) { System.out.println(\"Economy Car!\");
     } System.out.println(\"\");
     milesS = milesS + milesE;
     System.out.println(\"Enter new miles\");
      milesE = scan.nextDouble();
     System.out.println(\"Enter gallons used: \");
      gallonsU = scan.nextDouble();
     car.fillUp(milesE, gallonsU);
     System.out.println(\"Initial miles: \" + milesS);
     System.out.println(\"New Miles: \" + milesE);
     System.out.println(\"Gallons used: \" + gallonsU);
     System.out.println( \"MPG: \" + car.calculateMPG() );
     System.out.println(\"\"); } }

Why does the main class cannot find symbol symbol : constructor Car(double) location:
class Car .. ??
Please tell us which line of code you posted shows 'Car (double)'.
The only constructor that I see is this one:
Car(double start, double end, double gall)

Similar Messages

  • Compiler error: "cannot find symbol" - constructor

    Dear all,
    I keep getting the compiler error "cannot find symbol" - constructor AWTEvent() for the following class. It's supposed to extend AWTEvent to give me my own event to be fired. What could be wrong?
    import java.awt.*;
    import java.awt.event.*;
    public class MyButtonEvent extends AWTEvent
         public MyButtonEvent()
    }Thanks a lot!
    N

    When you do this
    public MyButtonEvent()
    }you are implicitly calling the super class constructor with no parameters
    That is:
    AWTEvent();
    you can think of it as
    public MyButtonEvent()
         AWTEvent(); // <-- automatically generated for you
         //the rest of your stuff
    }the problem is that AWTEvent has no such constructor, so you need to explicitly put another constructor in your constructor as the first statement. This other constructor has to be one that exists in AWTEvent.

  • [Greenfoot] "cannot find symbol - constructor Plotter"?

    I am attempting to make a sinusoid plotter as part of my math class. Using Greenfoot, I have created a class Plotter, which is supposed to accept amplitude, frequency, vertical displacement, and phase displacement and then plot the resulting sinusoid. Everything works fine, except when I try to compile the program I get an error message "cannot find symbol - constructor Plotter(float,float,float,float)" when I compile the World object which creates the Plotter object. My call in the World object's constructor:
    GraphWorld()
    // Create the field, which is 800x450 pixels.
    super(800, 450, 1);
    // These will eventually be set by a prompt to the user.
    float amp = 1;
    float freq = 1;
    float vd = 0;
    float pd = 0;
    addObject(new Plotter(amp,freq,vd,pd), 0, 225);
    }I am currently using a workaround by changing the code directly within the Plotter class, but I would like to find the source of the problem.

    Grey_Ghost wrote:
    It should.That's what the compiler thinks too.
    Here is the constructor as it is defined in class Plotter:
    public void Plotter(float Amplitude, float Frequency, float VertDisp, float PhaseDisp)
    amplitude = Amplitude;
    frequency = Frequency;
    vertDisp = VertDisp;
    phaseDisp = PhaseDisp;
    Except that's not a constructor. Constructors don't have return values.

  • Cannot find symbol:constructor

    here is my code...
    package org.tiling.didyoumean;
    import java.io.IOException;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.BufferedReader;
    import org.apache.lucene.index.Term;
    import org.apache.lucene.queryParser.ParseException;
    import org.apache.lucene.search.Query;
    import org.apache.lucene.search.TermQuery;
    import org.apache.lucene.search.spell.SpellChecker;
    import org.apache.lucene.store.Directory;
    import org.apache.lucene.store.FSDirectory;
    import org.apache.commons.cli.ParseException;
    public class spell {
         public static void main(String args[]){
              System.out.println("hi");
         String spellIndex = "C://opt//lucene//didyoumean//indexes//spell";
         SpellChecker spellChecker = new SpellChecker(spellIndex);
         String[] similarWords = spellChecker.suggestSimilar("jva", 1);
         System.out.println(similarWords[0]);
    }and the error i am kept getting is
    C:\Documents and Settings\sumit-i\Desktop\didyoumean\didyoumean-1.0\src\java>javac org/tiling/didyoumean/spell.java
    org\tiling\didyoumean\spell.java:29: cannot find symbol
    symbol  : constructor SpellChecker(java.lang.String)
    location: class org.apache.lucene.search.spell.SpellChecker
            SpellChecker spellChecker = new SpellChecker(spellIndex);
                                        ^
    1 errorany ideas..plzz

    here is the Directory.java,....please help me if you can....actually i have a deadline to submit this..but i am not getting this...
    package org.apache.lucene.store;
    * Licensed to the Apache Software Foundation (ASF) under one or more
    * contributor license agreements.  See the NOTICE file distributed with
    * this work for additional information regarding copyright ownership.
    * The ASF licenses this file to You under the Apache License, Version 2.0
    * (the "License"); you may not use this file except in compliance with
    * the License.  You may obtain a copy of the License at
    *     http://www.apache.org/licenses/LICENSE-2.0
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    * See the License for the specific language governing permissions and
    * limitations under the License.
    import java.io.IOException;
    /** A Directory is a flat list of files.  Files may be written once, when they
    * are created.  Once a file is created it may only be opened for read, or
    * deleted.  Random access is permitted both when reading and writing.
    * <p> Java's i/o APIs not used directly, but rather all i/o is
    * through this API.  This permits things such as: <ul>
    * <li> implementation of RAM-based indices;
    * <li> implementation indices stored in a database, via JDBC;
    * <li> implementation of an index as a single file;
    * </ul>
    * Directory locking is implemented by an instance of {@link
    * LockFactory}, and can be changed for each Directory
    * instance using {@link #setLockFactory}.
    * @author Doug Cutting
    public abstract class Directory {
      /** Holds the LockFactory instance (implements locking for
       * this Directory instance). */
      protected LockFactory lockFactory;
      /** Returns an array of strings, one for each file in the
       * directory.  This method may return null (for example for
       * {@link FSDirectory} if the underlying directory doesn't
       * exist in the filesystem or there are permissions
       * problems).*/
      public abstract String[] list()
           throws IOException;
      /** Returns true iff a file with the given name exists. */
      public abstract boolean fileExists(String name)
           throws IOException;
      /** Returns the time the named file was last modified. */
      public abstract long fileModified(String name)
           throws IOException;
      /** Set the modified time of an existing file to now. */
      public abstract void touchFile(String name)
           throws IOException;
      /** Removes an existing file in the directory. */
      public abstract void deleteFile(String name)
           throws IOException;
      /** Renames an existing file in the directory.
       * If a file already exists with the new name, then it is replaced.
       * This replacement is not guaranteed to be atomic.
       * @deprecated
      public abstract void renameFile(String from, String to)
           throws IOException;
      /** Returns the length of a file in the directory. */
      public abstract long fileLength(String name)
           throws IOException;
      /** Creates a new, empty file in the directory with the given name.
          Returns a stream writing this file. */
      public abstract IndexOutput createOutput(String name) throws IOException;
      /** Returns a stream reading an existing file. */
      public abstract IndexInput openInput(String name)
        throws IOException;
      /** Returns a stream reading an existing file, with the
       * specified read buffer size.  The particular Directory
       * implementation may ignore the buffer size.  Currently
       * the only Directory implementations that respect this
       * parameter are {@link FSDirectory} and {@link
       * org.apache.lucene.index.CompoundFileReader}.
      public IndexInput openInput(String name, int bufferSize) throws IOException {
        return openInput(name);
      /** Construct a {@link Lock}.
       * @param name the name of the lock file
      public Lock makeLock(String name) {
          return lockFactory.makeLock(name);
       * Attempt to clear (forcefully unlock and remove) the
       * specified lock.  Only call this at a time when you are
       * certain this lock is no longer in use.
       * @param name name of the lock to be cleared.
      public void clearLock(String name) throws IOException {
        if (lockFactory != null) {
          lockFactory.clearLock(name);
      /** Closes the store. */
      public abstract void close()
           throws IOException;
       * Set the LockFactory that this Directory instance should
       * use for its locking implementation.  Each * instance of
       * LockFactory should only be used for one directory (ie,
       * do not share a single instance across multiple
       * Directories).
       * @param lockFactory instance of {@link LockFactory}.
      public void setLockFactory(LockFactory lockFactory) {
          this.lockFactory = lockFactory;
          lockFactory.setLockPrefix(this.getLockID());
       * Get the LockFactory that this Directory instance is
       * using for its locking implementation.  Note that this
       * may be null for Directory implementations that provide
       * their own locking implementation.
      public LockFactory getLockFactory() {
          return this.lockFactory;
       * Return a string identifier that uniquely differentiates
       * this Directory instance from other Directory instances.
       * This ID should be the same if two Directory instances
       * (even in different JVMs and/or on different machines)
       * are considered "the same index".  This is how locking
       * "scopes" to the right index.
      public String getLockID() {
          return this.toString();
       * Copy contents of a directory src to a directory dest.
       * If a file in src already exists in dest then the
       * one in dest will be blindly overwritten.
       * @param src source directory
       * @param dest destination directory
       * @param closeDirSrc if <code>true</code>, call {@link #close()} method on source directory
       * @throws IOException
      public static void copy(Directory src, Directory dest, boolean closeDirSrc) throws IOException {
          final String[] files = src.list();
          if (files == null)
            throw new IOException("cannot read directory " + src + ": list() returned null");
          byte[] buf = new byte[BufferedIndexOutput.BUFFER_SIZE];
          for (int i = 0; i < files.length; i++) {
            IndexOutput os = null;
            IndexInput is = null;
            try {
              // create file in dest directory
              os = dest.createOutput(files);
    // read current file
    is = src.openInput(files[i]);
    // and copy to dest directory
    long len = is.length();
    long readCount = 0;
    while (readCount < len) {
    int toRead = readCount + BufferedIndexOutput.BUFFER_SIZE > len ? (int)(len - readCount) : BufferedIndexOutput.BUFFER_SIZE;
    is.readBytes(buf, 0, toRead);
    os.writeBytes(buf, toRead);
    readCount += toRead;
    } finally {
    // graceful cleanup
    try {
    if (os != null)
    os.close();
    } finally {
    if (is != null)
    is.close();
    if(closeDirSrc)
    src.close();
    please let me know....if you any idea about it..
    thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Why does the child class need to implement the parent classes constructor?/

    As I was playing around with some code I came across this point :
    First Class
    public class A {
         public int x;
         A(int i){
              x=i;
              System.out.println("A is initialised");
    }Second Class extending it :
    public class B extends A{
         private int y;
       // Why do I need this constructor to call parents constructor?
      // My guess is so that when i make an object of class B referring to class A it should make sense?
         B(int i) {                     
              super(i); 
              y=test;
    public static void main(String args[]){
          A a = new A(1);
          A b = new B(1); make an object of class B referring to class A it should work!!
          B c = new B(2);
          B d =(B) new A(2);  --> gives class cast exception!
    }I am little confused here, Can someone throw more light on it.
    Thanks

    You don't override constructors. However, every class, in it's constructor, must call some constructor from the class it's extending. In most cases this is simply super(). However, if your class does not have a default constructor (i.e. you've declared any other constructor, or the sub class does not have access to it, I.E. you've declared it private) then you must include a call to some other constructor in the super class. The constructor in the subclass does not have to be the same as the super class one, but you do have to invoke a constructor from the super class. I.E.
    class A {
      A(int i) {}
    class B extends A {
      B(String b) {
        super(0);
    }

  • Re: cannot find symbol constructor Arc2D

    hi
    The subject might suggest this is should be posted in java2d forum but I believe this is related to basic programmming knowledge. So please take a look at it.
    I am trying to create a subclass to the Arc2D abstract class. Although it works fine when I change the superclass to Arc2D.Double. Could some body point the mistakes.
    I greatly appreciate any help.
    here is the error.
    symbol  : constructor Arc2D()
    location: class java.awt.geom.Arc2D
        public Arc(Graphics2D g2, int x0, int y0, int mdptx, int mdpty, int x1, int y1,int clickCount){
    1 error
    BUILD FAILED (total time: 0 seconds)here is the code in the class.
    package Drawing2d;
    import java.awt.BasicStroke;
    import java.awt.Color;
    import java.awt.Graphics2D;
    import java.awt.Shape;
    import java.awt.geom.Arc2D;
    import java.awt.geom.Point2D;
    import java.awt.geom.Rectangle2D;
    public class Arc extends Arc2D implements Shape{
        Circle aeli;
        SketchEnvironment SE;   
        int[] coord = new int[4];
        double width;
        double startAngle,endAngle, extent;
        float[] dashPattern = { 5, 2, 2, 2 };
        double x0,y0;
        Arc2D.Double ar;
        Point2D.Double pts[] = new Point2D.Double[3];
        public Arc(Graphics2D g2, int x0, int y0, int mdptx, int mdpty, int x1, int y1,int clickCount){
            ar = new Arc2D.Double();
            if(clickCount == 1){
            g2.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER, 10,
                                      dashPattern, 0));      
            //aeli.mainColor = Color.GREEN;                   
            width =  java.lang.Math.sqrt(java.lang.Math.pow((x1- x0),2)
                    + java.lang.Math.pow((y1 - y0) ,2));
            g2.setColor(Color.GREEN);
            g2.drawOval((int)(x0 - width), (int)(y0 - width),(int) (2*width), (int)(2*width));       
            else if(clickCount == 2 || clickCount == 3){           
                startAngle = Math.toDegrees(Math.atan2((mdpty - y0),(mdptx - x0)));
                endAngle = Math.toDegrees(Math.atan2((y1 - y0),(x1 - x0)));
                double extent = getExtent(startAngle, endAngle);  
                width = java.lang.Math.sqrt(java.lang.Math.pow((mdptx- x0),2)
                    + java.lang.Math.pow((mdpty - y0) ,2));
                g2.setColor(Color.WHITE);
                ar.setArc(x0-width,y0-width,2*width,2*width,-startAngle,
                        extent,java.awt.geom.Arc2D.OPEN);
    //            ar = new Arc2D.Double(x0-width,y0-width,2*width,2*width,-startAngle,
    //                    extent,java.awt.geom.Arc2D.OPEN);
                g2.draw(ar);
         * One area of difficulty is that java measures angles
         * positive clockwise from zero at 3 o'clock and arcs
         * measure angles positive anti-clockwise from the
         * beginning of the arc segment.
         * Contributed by CRWood from sun's java2d forum**/
        private double getExtent(double start, double end) {
            double extenti = (360-end) - (360-start);
            if(extenti < 0)
                extenti += 360;
            return extenti;
        public double getAngleStart() {
            return startAngle;
        public double getAngleExtent() {
            return endAngle;
        public void setArc(double x, double y, double w, double h, double angSt, double angExt, int closure) {
            this.setArc(x, y, w, h, angSt, angExt, closure);
        public void setAngleStart(double angSt) {
            startAngle = angSt;
        public void setAngleExtent(double angExt) {
            this.extent = angExt;
        @Override
        public double getX() {
            return x0 - width;
        public double getY() {
            return y0 - width;
        public double getWidth() {
            return width;
        public double getHeight() {
            return width;
        public boolean isEmpty() {
            return this.isEmpty();
        protected Rectangle2D makeBounds(double x, double y, double w, double h) {
            this.makeBounds(x, y, w, h);
    }

    Are you sure you need to subclass Arc2D? There are already concrete subclasses Arc2D.Float and Arc2D.Double? How about using composition rather than subclassing? I ask because I've never seen anyone need to subclass these geometry classes before.

  • Cannot find Symbol :class CLOB

    Hi,
    I am using JDK1.5.0_06 and Oracle8.1.7.
    When i compile java program I am getting the following error
    cannot find symbol
    symbol : class CLOB
    I have added classes12.zip into classpath.
    Can anybody tell me why this errpr comes? Is there any other files instead of classes12.zip to be added (since its JDK1.5 version? )
    Thanks in advance
    neema

    you have mentioned about the class "studentList" but that class is not to be found in the code you have pasted. its instead "ListTest". And the "menu" function seems to b a part of "ListTest" class. Can you provide the structure of the classes "studentList" and "Student" so that the problem can be more clearly understood?
    also you are using the variable "Stdin" in the line int choice = Stdin.readInteger(); where as you have not declared this variable.
    in the "switch" statement you are calling two different functions for the same case "3" where as it should be "case 3" and "case 4" respectively.
    in the "main" you are calling the "menu" function without any parameter while you actually want to pass argument of type "studentList".

  • Please help. Cannot find symbol Error!

    I have been working on this code for days now. It keeps coming up with errors. The error says cannot find symbol. I will bold the areas that say that. I got it down to 23 from 42 but now I have no idea what the problem is. any help is greatly appreciated!! I only added a couple of them mainly because it is overwhelming. I can add the rest of someone replies. Thank you again. Oh and the Classpath is set right. I am compiling from the desktop where I have the file also. That was the first thing I checked after reading other threads related to this issue. :O)
    import javax.swing.*;
    import java.awt.event.*;
    public class InventoryPart4 extends JFrame
         private JTextArea text;
         private Inventory inv;
         private int view;
         public InventoryPart4() {
              super("Product");
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // quit if the window is closed
              view = 0; // current one showing
              Product product;
              inv = new Inventory(4);
              product = new Product(1, "Salad", 3, 4.95); here
              inv.add(product, 0);
    product = new Product(2, "Dressing", 6, 3.00); here          
    inv.add(product, 1);
    product = new Product(3, "Bacon Bits", 2, 1.75);*here*
              inv.add(product, 2);
    product = new Product(4, "Croutons", 1, 1.75); here
              inv.add(product, 3);
              // sort
              inv.sort();
              // output
              for (int i = 0; i < 4; i++) {
                   System.out.println(inv.get(i));
              // total val
              System.out.printf("Total=$%.2f", inv.totalValue());
              //gui
              JPanel panel = new JPanel();
              panel.setLayout(new BoxLayout(panel,BoxLayout.Y_AXIS));
              text = new JTextArea(10,50);
              text.setEditable(false);
              panel.add(text);
              showProduct();
              JButton next = new JButton("Next");
    here          next.addProduct(new Product() {
                   public void actionPerformed(ActionEvent e) {
                        if (view < inv.size()-1) view++;
                        else view = 0;
                        showProduct();
              panel.add(next);
              getContentPane().add(panel);
         // view an item
         public void showProduct() {
              text.setText("Product Details:\n");
              text.append(inv.get(view).toString()+"\n");
              text.append(String.format
                        ("Value of all the Contents: $%.2f", inv.totalValue()));
         public static void main(String args [])
              InventoryPart4 invt = new InventoryPart4();
              invt.pack();
              invt.setVisible(true);
         } //end main
    } // end class InventoryPart1
    class Product {
    private int ProductItem;
    private int ProductStock;
    private double ProductPrice;
    public Product(int item, int stock, double price) {
    ProductItem = item;
    ProductStock = stock;
    ProductPrice = price;
    } //end three-argument constructor
    // set Product Item
    public void setProductItem(int item) {
    ProductItem = item; here
    } //end method set Product Item
    //return Product Item
    public int getsProductItem() {
    return productItem;
    } //end method get product Item
    //set Product Stock
    public void setProductStock(int stock) {
    productStock = stock;
    } //end method set Product Stock
    //return Product Stock
    public int getProductStock() {
    return productStock;
    } //end method get Product Stock
    public void setProductPrice(double price) {
    productPrice = price;
    } //end method setproductPrice
    //return Product Price
    public double getProductPrice() {
    return ProductPrice;
    } //end method get Product Price
    //calculate inventory value
    public double value() {
    return productPrice * productStock;
    }// end method get productPrice and productStock
    @Override
    public String toString() {
    return String.format("item=%3d units=%d price=%.2f value=%.2f",
    productItem, productStock, productPrice, value());
    }//end class Product
    class Inventory {
         private Product[] list;
         // constructor
         public Inventory(int size) {
              list = new Product[size];
         // complete value
         public double totalValue() {
              double val = 0.0;
              for (int i = 0; i < list.length; i++) {
                   val += list.value();
              return val;
         // add an item
         public void add(Product i, int p) {
              list[p] = i;
         // get an item
         public Product get(int i) {
              return list[i];
         // sort by name
         public void sort() {
              // bubble sort
              int n = list.length;
              for (int search = 1; search < n; search++) {
                   for (int i = 0; i < n-search; i++) {
                        if (list[i].getProductItem().compareToIgnoreCase(list[i+1].getProductItem()) > 0) {
                             // swap
                             Product temp = list[i];
                             list[i] = list[i+1];
                             list[i+1] = temp;
         public int size() {
              return list.length;
    //extended class
    class Contents extends Product {
         private String Contents;
         // constructor
         public Contents(int item, String name, int units, double price) {
              super(item,name,units, price);
              this.contents = contents;
         // getter
         public String getContents() {
              return Contents;
         // total value with the 5% fee
         public double value() {
              return super.value()*1.05;
         // just the 5% fee
         public double fee() {
              return super.value()*0.05;
         // setter
         public void setContents(String contents) {
              this.contents = contents;
         public String toString()
              return super.toString() + String.format(" fee=%.2f contents=%-20s",
                        fee(), contents);

    The error says cannot find symbol.It says more than that. It says what symbol it cannot find, and it points to the line of code where the symbol was used.
              product = new Product(1, "Salad", 3, 4.95); *here*So it can't find a class called Product with an accessible constructor Product(int, String, int, double).
    product = new Product(2, "Dressing", 6, 3.00); *here*          
    inv.add(product, 1);
    product = new Product(3, "Bacon Bits", 2, 1.75);*here*
              inv.add(product, 2);
    product = new Product(4, "Croutons", 1, 1.75); *here*
              inv.add(product, 3);Ditto.
              JButton next = new JButton("Next");
    *here*          next.addProduct(new Product() {JButton doesn't have an addProduct() method.
    public Product(int item, int stock, double price) {This constructor doesn't match the constructor you are calling above, and there are no other constructors.
    ProductItem = item; *here*You must have a typo. But don't use inital capitals on field names: use them only on class names.
    return productItem;Here is evidence that you have a typo. Java is case-sensitive. Either the field is caled 'ProductItem' or it is called 'productItem', not both.
              // bubble sortDo you have to do this for the homework? Bubble sort is never used in real code except by people who don't know what they're talking about. Use Collections.sort().
              super(item,name,units, price);You should be getting a compile error here too. Ther is no such constructor for Product.
              return Contents;And here.

  • Cannot find symbol while referring to an overloaded constructor

    Hi, I've a VERY strange problem. It's an hour I'm trying to work this out without any luck....
    here is my code
         public DueDPanel(int limite, int valore, int incremento) throws NumberOutOfBoundException
              this.limite=limite;
              setValore(valore);
              upBy=incremento;
         public DueDPanel(int limite, int valore) throws NumberOutOfBoundException
              { DueDPanel(limite,valore,1); }
         public DueDPanel(int limite) throws NumberOutOfBoundException
              { DueDPanel(limite,0,1); }
         public DueDPanel() throws NumberOutOfBoundException
              { DueDPanel(99,0,1); }I get a c-time error
    .\DueDPanel.java:25: cannot find symbol
    symbol : method DueDPanel(int,int,int)
    location: class DueDPanel
    { DueDPanel(limite,valore
    ^
    .\DueDPanel.java:28: cannot find symbol
    symbol : method DueDPanel(int,int,int)
    location: class DueDPanel
    { DueDPanel(limite,0,1);
    ^
    .\DueDPanel.java:31: cannot find symbol
    symbol : method DueDPanel(int,int,int)
    location: class DueDPanel
    { DueDPanel(99,0,1); }
    How could it be? why in the world it cannot find my int,int,int method?
    I'm damn sure this is an easy problem, but..... thankyou sooooo much!!

    Ok, a superior-class developer friend of mine found a solution.
    I simply replaced the method indetifier with this(....).
    public DueDPanel() throws NumberOutOfBoundException
              { this(99,0,1); }Could someone please explain why this didn't work as I expeced?

  • Cannot find symbol symbol  : constructor

    I'm a java student, I've recently started constructors and inheritence, I've been pouring over my text book
    all day and I've can't work out what I have done wrong in my code.
    class TestComputer
    {  public static void main (String [ ] args)
         Computer IBM = new Computer ("IBM",286);
          System.out.println(IBM);
    public class Computer extends TestComputer{
              protected String processorModel;
                    protected int clockSpeed;
        public Computer() {
             this.processorModel = processorModel;
             this.clockSpeed = clockSpeed;
        public String toString ()
              String result = "Processor Model: " + processorModel + "\n";
                      result += "Clock Speed: " + clockSpeed + "\n";
              return result;
    }The error I am getting is cannot find symbol constructor Computer(java.lang.String,int)
    and I can't for the life of me work out why.
    Edited by: FallingLeaves on Sep 9, 2008 11:07 PM

    Computer IBM = new Computer ("IBM",286);The error message tells you everything you need to know. The above line is calling a constructor with 2 parameters: String and int. Where in your class is the constructor that takes those 2 parameters?

  • Java.util.concurrent.LinkedBlockingDeque: cannot find symbol

    Hello,
    I'm trying to use an existing java code into a JavaFX application. To do this, I copied all my sources into the fx project in Netbeans and I linked the needed libraries, but when I tried to compile all this, I got the following message:
    "cannot find symbol
    symbol : class LinkedBlockingDeque
    location: package java.util.concurrent
    import java.util.concurrent.LinkedBlockingDeque;"
    the problem is at that line: import java.util.concurrent.LinkedBlockingDeque;
    This is a native java class. Is it not supported in JavaFx? Is not java fully compatible with Fx? What's happening?
    Thank you in advance

    Please, create an issue on it with the detailed comments: [http://www.netbeans.org/issues/enter_bug.cgi?component=javafx|http://www.netbeans.org/issues/enter_bug.cgi?component=javafx]

  • Issue with - "cannot find symbol - variable JOptionPane"

    need some help, got the below loop and want it to be able to loop by the number input by the input dialog. when i compile it i get an error in BlueJ. the error is "cannot find symbol - variable JOptionPane". Any help. have tried a few things however cannot get this to work at all. any suggestions?
    public void numberLoop()
    String qA = JOptionPane.showInputDialog(null,"How many times should this be completed (e.g. 1,2,3,4)?","Question",JOptionPane.QUESTION_MESSAGE);
    int qA2 = Integer.parseInt(qA);
    for (int startNum = 1; startNum <= qA2; startNum++)
    System.out.println(startNum + " squared is " + (startNum * startNum));
    }

    never mind i fixed it. forgot the below.
    import javax.swing.JOptionPane;
    LOL

  • In formcentral, why does the "proceed to checkout" button not work? on IE I get error " This content cannot be displayed in a frame...

    In formcentral, why does the "proceed to checkout" button not work? on IE I get error " This content cannot be displayed in a frame. To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame ". On Chrome I get nothing but loading.

    Hi,
     This error is generally specific to Internet Explorer and has two possible causes. The most likely explanation is that your browser has unusual browser security settings. I would recommend you try
    resetting your security settings to defaults (varies by version but all essentially the same). You may also have to turn off
    Protected Mode which is enabled by default on some systems. If you’re seeing this error (or a version of it) outside Internet Explorer, you may have a server-level setting that is preventing your content from being framed.
    Reference:https://social.technet.microsoft.com/Forums/exchange/en-US/1460c5a5-6242-4402-9f6b-bc581bf56478/content-cannot-be-displayed-in-a-frame-when-trying-to-add-item?forum=sharepointgeneral
    Thanks,
    Eric
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Eric Tao
    TechNet Community Support

  • Why does the content of my emails not show on the main Mail page but does in the Inbox list of all emails?

    Why does the content of my emails not show on the main Mail page but does in the Inbox list of all emails?

    Try a Reset [Hold the Home and Sleep/Wake buttons down together for 10 seconds or so (until the Apple logo appears) and then release. When the screen goes blank power On again in the normal way.] It is absolutely/appsolutely safe!

  • Why does the Right-click - "t" delete a bookmark on the bookmark toolbar, when Right-click - "t" opens a new tab elsewhere. The bookmark toolbar use Right-click - "w" to open in a new tab. Please change this to "t" to...

    Why does the Right-click -> "t" delete a bookmark on the bookmark toolbar, when Right-click -> "t" opens a new tab elsewhere in Firefox. The bookmark toolbar use Right-click -> "w" to open in a new tab. Please change this to "t" to... I keep deleting all my bookmark because you don't make the commands consistent!

    If you have accidentally removed bookmarks then use "Organize > Undo" in the bookmarks manager (Bookmarks > Organize Bookmarks) to get them back.<br />
    The Organize button is the first of the three buttons on the toolbar in the Library (Bookmarks Manager).<br />
    That only works if you haven't closed Firefox.
    [https://bugzilla.mozilla.org/show_bug.cgi?id=301888 Bug 301888] – Bookmarks cut instead of opened in new tab from Bookmarks Toolbar Folder
    (please do not comment in bug reports; you can vote instead)

Maybe you are looking for

  • Expanding a JTree Node on selection

    Hi, I have a need to expand the node on selection in a JTree. I would like all the children to be recursively expanded and selected. I believe the code lies somewhere with in JTree's TreeSelectionListener. The code I have is as follows tree.addTreeSe

  • Can I use Migration assistant AFTER SnowLeopard installs??

    I am asking because I would like to install the OS10.6.4 combo update BEFRE running Migration Assistant. This possible???

  • How to open a copied iPhoto library

    I recently got a new 2014 MacBook Pro. My old MacBook Pro is a 2009. I had a 1TB hard drive in my old MacBook Pro and decided to put that into an external drive to keep with me to use with my new computer. I didn't want to take out or mess with the s

  • What setting should I use to save file for upload to youtube

    Hi, the link below is the video on youtube that I just saved using the first setting that I always use using Flash.  Now because of the change over, as we have discussed I have to save the file then upload it for sites I upload to after the change. 

  • How can i change billing and profile names?

    I want to enroll the iOS Developer Program, the one of the $99... But I'm 15 years old, and don't have an credit card, so, my father had to lend me his. But there at the forms you have to fill, they say the name has to be the same as on the credit ca