init:
deps-jar:
Compiling 1 source file to C:\NetBeansProjects\SCHOOL1\JavaApplication31\build\classes
C:\NetBeansProjects\SCHOOL1\JavaApplication31\src\javaapplication31\Inventory3a.java:185: cannot find symbol
symbol : constructor Product(java.lang.String,double,double,double)
location: class javaapplication31.Product
super( dvdTitle, dvdItemNumber, dvdStock, dvdPrice);
1 error
BUILD FAILED (total time: 0 seconds)

package javaapplication31;



import java.util.Arrays;





public class Inventory3a{
      
      
   
        Inventory3a() {    // constructor  
            
            
            
           Product[] dvd =  new Product[4];  
      
            dvd[0] = new Product(685.0,"How to Loose a Guy in 10 days",2003, 4, 19.99 );  
            dvd[1] = new Product(565.0,"Coyote Ugly Ugly",2000, 8, 19.98 );  
            dvd[2] = new Product(785.0,"Legally Blonde",2001, 13, 19.99);  
           dvd[3] = new Product(578.0,"Sweet Home Alabama",2002, 8,18.56); 
           
             double totalInStock = 0.0;
             double totalValue = 0.0; 
            
              for(int i = 0; i < 4; i++) 
              {  
                 
                      
               System.out.println("Item number:  " + dvd[i].getdvdItemNumber());
               System.out.println("Title: " + dvd[i].getdvdTitle());
               System.out.println("Made in: "+ dvd[i].getdvdYear());
               System.out.println("In Stock: " + dvd[i].getdvdStock());  
               System.out.println("The price of each DVD is $" + dvd[i].getdvdPrice());
               System.out.println("The value of the inventory is $" + dvd[i].Calvalue());  
               totalInStock += dvd[i].getdvdStock();
               totalValue += dvd[i].Calvalue();
               System.out.println("Total In Stock:" + totalInStock + 
                       " Total Value:  $" +      totalValue);
              System.out.println("Restock Fee: " + (dvd[i].getdvdStock() * dvd[i].getdvdPrice()) * 0.05);}
              System.out.println(); 
     
        }
     
       public static void main(String args []) {  
     
                 //Sorting strings
      String[ ] titles = {"How to Loose a Guy in 10 days", "Coyote Ugly", "Legally Blonde", "Sweet Home Alabama"};
      Arrays.sort(titles);    //use the built-in sorting routine
      for (int i = 0; i < 4; i++)
         System.out.println(titles[ i ]);
   
   double ReStockFee = 0.05; 
           new Inventory3a();  
     
       } //end method main  
    
}
        class Product
        {
           public double dvdItemNumber; 
           public String dvdTitle;
           public double dvdYear;
           public double dvdStock;
           public double dvdPrice;
           public double totalInStock;
           public double totalValue;
           public double ReStockFee;
           
           // five-argument constructor
           Product(double item,String title,double year, double stock, double price ) 
           {  
               dvdItemNumber  = item;
               dvdTitle = title; 
               dvdYear = year;
               dvdStock = stock;  
               dvdPrice = price;  
                 
           } //end five-argument constructor
           
            // set dvd item number
           public void setdvdItemNumber (double item)
           {
               dvdPrice= item;
           }// end method setdvdItemNumber
           
           
           // return dvd item number
           public double getdvdItemNumber()
           {
               return dvdItemNumber;
           }// end method getdvdItemNumber
           
           // set dvd title
           public void setdvdTitle (String title)
           {
               dvdTitle= title;
           }// end method setdvdTitle
           
           // return dvd title
           public String getdvdTitle()
           {
               return dvdTitle;
           }// end method getdvdTitle
           
            // set dvd year
          // set dvd stock
           public void setdvdYear(double year)
           {
               dvdYear= year;
           
           }// return dvd year
           public double getdvdYear()
           {
               return dvdYear;
           }// end method getdvdYear
           
           // set dvd stock
           public void setdvdStock(double stock)
           {
               dvdStock= stock;
           } // end method getdvdStock
           
           // return dvd stock
           public double getdvdStock()
           {
               return dvdStock;
           }// end method getdvdStock
           
           // set dvd price
           public void setdvdPrice (double price)
           {
               dvdPrice= price;
           }// end method setdvdPrice
           
           
           // return dvd price
           public double getdvdPrice()
           {
               return dvdPrice;
           }// end method getdvdPrice
           
             // set total in stock
           public void settotalInStock (double total)
           {
               totalInStock= total;
           }// end method settotalInStock
           
            // return total in stock
           public double gettotalInStock()
           {
               return totalInStock;
           }// end method gettotalInStock
               
          
               
           // caluclate Inventory
           public double Calvalue() {  
               return dvdPrice * dvdStock;  
           } //end method value  
           
          // calculates Total Value
             public double totalValue(){
                     return dvdPrice * totalInStock;
             } // end method value
           
             
             
          // returns smaller, bigger or equals according to dvdTitle
      public int compareTo(Object o){
          Product other = (Product) o;
          return dvdTitle.compareTo(other.dvdTitle);
 
      }
           
    class Movie extends Product
{
private double reStockingFee;

public Movie(String dvdTitle, double dvdItemNumber, double dvdStock, double dvdPrice, double reStockingFee)
{
super( dvdTitle, dvdItemNumber, dvdStock, dvdPrice);
this.reStockingFee = reStockingFee;
}
        @Override
public double getdvdPrice() //returns the value of the inventory, plus the restocking fee
{
return super.getdvdPrice() + reStockingFee;
}
        @Override
public String toString()
{
return new StringBuffer().append("Price: " + super.getdvdPrice()).append(" With RestockingFee: " + getdvdPrice()).toString();
}

} // end class Movie

     
           
      
   } //end class Product

Read the message: You are calling the super() constructor with arguments that do not match any declared constructor in the parent class.

Read the message: You are calling the super() constructor with arguments that do not match any declared constructor in the parent class.

That pretty much sums it up.

For a more thorough explanation--

// somewhere in product...

// only Constructor for product defined

// takes a double, String, double, double, and double
 Product(double item,String title,double year, double stock, double price )
class Movie extends Product
{
private double reStockingFee;

public Movie(String dvdTitle, double dvdItemNumber, double dvdStock, double dvdPrice, double reStockingFee)
{

// calling Product constructor String, double, double, double

// you forgot to provide a double argument before the String!

// compiler cannot locate this non-existant 4-arg constructor in Product!
super( dvdTitle, dvdItemNumber, dvdStock, dvdPrice);

I am a little confused by what you mean: #
#
// you forgot to provide a double argument before the String!"

Compare the arguments that you are using in the super() call to those in the Product constructor. They must match in type, order, and number. Yours don't.

I am so very lost in where you are talking about, any other ways of explaining where to look to make the changes so it will work?

I am so very lost in where you are talking about, any other ways of explaining where to look to make the changes so it will work?

Alex did a good job of explaining it above. Product is the superclass. Movie is the subclass. Inside your Movie constructor, you have this line:

super( dvdTitle, dvdItemNumber, dvdStock, dvdPrice);

That means "Look in my superclass for a constructor that takes four arguments." Movie's superclass is Product. Product has one constructor. It's this one:

Product(double item,String title,double year, double stock, double price )

The above constructor takes five arguments. You've passed it four arguments. As Ezzaral mentioned, the number of arguments need to match, in addition to the argument types. What's year supposed to be? You haven't specified with this call:

super( dvdTitle, dvdItemNumber, dvdStock, dvdPrice);

So if I make them the same it would work?

So if I make them the same it would work?

Well, try it and find out. Don't be afraid to experiment. You at least won't get THAT error anymore if you make them the same, but you may have other errors. It is something you need to fix if you are going to keep that line in the program.

Do I need that line? With the Re-Stocking Fee? I am getting so confused right now I swear I am about in tears now I only have 2 days to have this done.

Do I need that line? With the Re-Stocking Fee? I am getting so confused right now I swear I am about in tears now I only have 2 days to have this done.

Post your updated code with Java-style code tags, which will add line numbers, then refer to the specific line number you are referring to. I don't know what line you are speaking about and I don't know if you have changed your code. For certain, you need to change or delete the line of code referred to earlier in this thread.

[code=JAVA] // paste code here. Line #'s are added.

[/code]

I have changed my code, and it is working but sadly it is not formatting my decimal correctly.

package javaapplication31;



import java.util.Arrays;





public class Inventory3a{
      
      
   
        Inventory3a() {    // constructor  
            
            
            
           Product[] dvd =  new Product[4];  
      
            dvd[0] = new Product(685.0,"How to Loose a Guy in 10 days",2003, 4, 19.99 );  
            dvd[1] = new Product(565.0,"Coyote Ugly Ugly",2000, 8, 19.98 );  
            dvd[2] = new Product(785.0,"Legally Blonde",2001, 13, 19.99);  
           dvd[3] = new Product(578.0,"Sweet Home Alabama",2002, 8,18.56); 
           
             double totalInStock = 0.0;
             double totalValue = 0.0; 
             double ReStockingFee= 0.0;
              for(int i = 0; i < 4; i++) 
              {  
                 
                      
               System.out.println("Item number:  " + dvd[i].getdvdItemNumber());
               System.out.println("Title: " + dvd[i].getdvdTitle());
               System.out.println("Made in: "+ dvd[i].getdvdYear());
               System.out.println("In Stock: " + dvd[i].getdvdStock());  
               System.out.println("The price of each DVD is $" + dvd[i].getdvdPrice());
               System.out.println("The value of the inventory is $" + dvd[i].Calvalue());  
               totalInStock += dvd[i].getdvdStock();
               totalValue += dvd[i].Calvalue();
               System.out.println("Total In Stock:" + totalInStock + 
                       " Total Value:  $" +      totalValue);
              System.out.println("Restock Fee: " + (dvd[i].getdvdStock() * dvd[i].getdvdPrice()) * 0.05);}
              System.out.println(); 
     
        }
     
       public static void main(String args []) {  
     
                 //Sorting strings
      String[ ] titles = {"How to Loose a Guy in 10 days", "Coyote Ugly", "Legally Blonde", "Sweet Home Alabama"};
      Arrays.sort(titles);    //use the built-in sorting routine
      for (int i = 0; i < 4; i++)
         System.out.println(titles[ i ]);
   
   double ReStockFee = 0.05; 
           new Inventory3a();  
     
       } //end method main  
    
}
        class Product
        {
           public double dvdItemNumber; 
           public String dvdTitle;
           public double dvdYear;
           public double dvdStock;
           public double dvdPrice;
           public double totalInStock;
           public double totalValue;
           public double ReStockFee;
           
           // five-argument constructor
           Product(double item,String title,double year, double stock, double price ) 
           {  
               dvdItemNumber  = item;
               dvdTitle = title; 
               dvdYear = year;
               dvdStock = stock;  
               dvdPrice = price;  
                 
           } //end five-argument constructor
           
            // set dvd item number
           public void setdvdItemNumber (double item)
           {
               dvdPrice= item;
           }// end method setdvdItemNumber
           
           
           // return dvd item number
           public double getdvdItemNumber()
           {
               return dvdItemNumber;
           }// end method getdvdItemNumber
           
           // set dvd title
           public void setdvdTitle (String title)
           {
               dvdTitle= title;
           }// end method setdvdTitle
           
           // return dvd title
           public String getdvdTitle()
           {
               return dvdTitle;
           }// end method getdvdTitle
           
            // set dvd year
          // set dvd stock
           public void setdvdYear(double year)
           {
               dvdYear= year;
           
           }// return dvd year
           public double getdvdYear()
           {
               return dvdYear;
           }// end method getdvdYear
           
           // set dvd stock
           public void setdvdStock(double stock)
           {
               dvdStock= stock;
           } // end method getdvdStock
           
           // return dvd stock
           public double getdvdStock()
           {
               return dvdStock;
           }// end method getdvdStock
           
           // set dvd price
           public void setdvdPrice (double price)
           {
               dvdPrice= price;
           }// end method setdvdPrice
           
           
           // return dvd price
           public double getdvdPrice()
           {
               return dvdPrice;
           }// end method getdvdPrice
           
             // set total in stock
           public void settotalInStock (double total)
           {
               totalInStock= total;
           }// end method settotalInStock
           
            // return total in stock
           public double gettotalInStock()
           {
               return totalInStock;
           }// end method gettotalInStock
               
          
               
           // caluclate Inventory
           public double Calvalue() {  
               return dvdPrice * dvdStock;  
           } //end method value  
           
          // calculates Total Value
             public double totalValue(){
                     return dvdPrice * totalInStock;
             } // end method value
           
             // calculates Re-Stocking Fee
             public double ReStockingFee(){
                 return dvdPrice * totalInStock * .05;
             }// end method value
                    
          // returns smaller, bigger or equals according to dvdTitle
      public int compareTo(Object o){
          Product other = (Product) o;
          return dvdTitle.compareTo(other.dvdTitle);
 
      }
        } // end Product Class

Close. You got the end tag wrong. It's

[code=JAVA] // paste code

[/code]

not

[code=JAVA] // paste code [/code=JAVA]

The beginning code tag was correct. Hit the "Preview" button first. That gives you a chance to see your post and edit it before publishing it. You'll see right away on the preview whether the code tags are correct, and you can see the line number to refer us to. Here's a link for DecimalFormat, which could come in handy.

http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html

package javaapplication31;



import java.util.Arrays;





public class Inventory3a{
      
      
   
        Inventory3a() {    // constructor  
            
            
            
           Product[] dvd =  new Product[4];  
      
            dvd[0] = new Product(685.0,"How to Loose a Guy in 10 days",2003, 4, 19.99 );  
            dvd[1] = new Product(565.0,"Coyote Ugly Ugly",2000, 8, 19.98 );  
            dvd[2] = new Product(785.0,"Legally Blonde",2001, 13, 19.99);  
           dvd[3] = new Product(578.0,"Sweet Home Alabama",2002, 8,18.56); 
           
             double totalInStock = 0.0;
             double totalValue = 0.0; 
             double ReStockingFee= 0.0;
              for(int i = 0; i < 4; i++) 
              {  
                 
                      
               System.out.println("Item number:  " + dvd[i].getdvdItemNumber());
               System.out.println("Title: " + dvd[i].getdvdTitle());
               System.out.println("Made in: "+ dvd[i].getdvdYear());
               System.out.println("In Stock: " + dvd[i].getdvdStock());  
               System.out.println("The price of each DVD is $" + dvd[i].getdvdPrice());
               System.out.println("The value of the inventory is $" + dvd[i].Calvalue());  
               totalInStock += dvd[i].getdvdStock();
               totalValue += dvd[i].Calvalue();
               System.out.println("Total In Stock:" + totalInStock + 
                       " Total Value:  $" +      totalValue);
              System.out.println("Restock Fee: " + (dvd[i].getdvdStock() * dvd[i].getdvdPrice()) * 0.05);}
              System.out.println(); 
     
        }
     
       public static void main(String args []) {  
     
                 //Sorting strings
      String[ ] titles = {"How to Loose a Guy in 10 days", "Coyote Ugly", "Legally Blonde", "Sweet Home Alabama"};
      Arrays.sort(titles);    //use the built-in sorting routine
      for (int i = 0; i < 4; i++)
         System.out.println(titles[ i ]);
   
   double ReStockFee = 0.05; 
           new Inventory3a();  
     
       } //end method main  
    
}
        class Product
        {
           public double dvdItemNumber; 
           public String dvdTitle;
           public double dvdYear;
           public double dvdStock;
           public double dvdPrice;
           public double totalInStock;
           public double totalValue;
           public double ReStockFee;
           
           // five-argument constructor
           Product(double item,String title,double year, double stock, double price ) 
           {  
               dvdItemNumber  = item;
               dvdTitle = title; 
               dvdYear = year;
               dvdStock = stock;  
               dvdPrice = price;  
                 
           } //end five-argument constructor
           
            // set dvd item number
           public void setdvdItemNumber (double item)
           {
               dvdPrice= item;
           }// end method setdvdItemNumber
           
           
           // return dvd item number
           public double getdvdItemNumber()
           {
               return dvdItemNumber;
           }// end method getdvdItemNumber
           
           // set dvd title
           public void setdvdTitle (String title)
           {
               dvdTitle= title;
           }// end method setdvdTitle
           
           // return dvd title
           public String getdvdTitle()
           {
               return dvdTitle;
           }// end method getdvdTitle
           
            // set dvd year
          // set dvd stock
           public void setdvdYear(double year)
           {
               dvdYear= year;
           
           }// return dvd year
           public double getdvdYear()
           {
               return dvdYear;
           }// end method getdvdYear
           
           // set dvd stock
           public void setdvdStock(double stock)
           {
               dvdStock= stock;
           } // end method getdvdStock
           
           // return dvd stock
           public double getdvdStock()
           {
               return dvdStock;
           }// end method getdvdStock
           
           // set dvd price
           public void setdvdPrice (double price)
           {
               dvdPrice= price;
           }// end method setdvdPrice
           
           
           // return dvd price
           public double getdvdPrice()
           {
               return dvdPrice;
           }// end method getdvdPrice
           
             // set total in stock
           public void settotalInStock (double total)
           {
               totalInStock= total;
           }// end method settotalInStock
           
            // return total in stock
           public double gettotalInStock()
           {
               return totalInStock;
           }// end method gettotalInStock
               
          
               
           // caluclate Inventory
           public double Calvalue() {  
               return dvdPrice * dvdStock;  
           } //end method value  
           
          // calculates Total Value
             public double totalValue(){
                     return dvdPrice * totalInStock;
             } // end method value
           
             // calculates Re-Stocking Fee
             public double ReStockingFee(){
                 return dvdPrice * totalInStock * .05;
             }// end method value
                    
          // returns smaller, bigger or equals according to dvdTitle
      public int compareTo(Object o){
          Product other = (Product) o;
          return dvdTitle.compareTo(other.dvdTitle);
 
      }
      
        } // end Product Class

I have seen it as return string format but I am not sure what all of the codes mean and which ones i need.

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.