User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 402,054 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,400 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 290 | Replies: 15
Reply
Join Date: May 2008
Posts: 34
Reputation: twgood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
twgood twgood is offline Offline
Light Poster

Please Help Compiling Error

  #1  
Jul 23rd, 2008
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2007
Location: USA
Posts: 2,660
Reputation: Ezzaral is a glorious beacon of light Ezzaral is a glorious beacon of light Ezzaral is a glorious beacon of light Ezzaral is a glorious beacon of light Ezzaral is a glorious beacon of light 
Rep Power: 11
Solved Threads: 262
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Posting Maven

Re: Please Help Compiling Error

  #2  
Jul 23rd, 2008
Read the message: You are calling the super() constructor with arguments that do not match any declared constructor in the parent class.
Reply With Quote  
Join Date: Jun 2008
Location: WA, USA
Posts: 672
Reputation: Alex Edwards has a spectacular aura about Alex Edwards has a spectacular aura about Alex Edwards has a spectacular aura about 
Rep Power: 4
Solved Threads: 56
Alex Edwards's Avatar
Alex Edwards Alex Edwards is offline Offline
Practically a Master Poster

Re: Please Help Compiling Error

  #3  
Jul 23rd, 2008
Originally Posted by Ezzaral View Post
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--

  1.  
  2. // somewhere in product...
  3.  
  4. // only Constructor for product defined
  5.  
  6. // takes a double, String, double, double, and double
  7. Product(double item,String title,double year, double stock, double price )

  1.  
  2. class Movie extends Product
  3. {
  4. private double reStockingFee;
  5.  
  6. public Movie(String dvdTitle, double dvdItemNumber, double dvdStock, double dvdPrice, double reStockingFee)
  7. {
  8.  
  9. // calling Product constructor String, double, double, double
  10.  
  11. // you forgot to provide a double argument before the String!
  12.  
  13. // compiler cannot locate this non-existant 4-arg constructor in Product!
  14. super( dvdTitle, dvdItemNumber, dvdStock, dvdPrice);
  15.  
Reply With Quote  
Join Date: May 2008
Posts: 34
Reputation: twgood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
twgood twgood is offline Offline
Light Poster

Re: Please Help Compiling Error

  #4  
Jul 23rd, 2008
I am a little confused by what you mean: #
#
// you forgot to provide a double argument before the String!"
Reply With Quote  
Join Date: May 2007
Location: USA
Posts: 2,660
Reputation: Ezzaral is a glorious beacon of light Ezzaral is a glorious beacon of light Ezzaral is a glorious beacon of light Ezzaral is a glorious beacon of light Ezzaral is a glorious beacon of light 
Rep Power: 11
Solved Threads: 262
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Posting Maven

Re: Please Help Compiling Error

  #5  
Jul 23rd, 2008
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.
Reply With Quote  
Join Date: May 2008
Posts: 34
Reputation: twgood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
twgood twgood is offline Offline
Light Poster

Re: Please Help Compiling Error

  #6  
Jul 23rd, 2008
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?
Reply With Quote  
Join Date: Jan 2008
Posts: 1,490
Reputation: VernonDozier is a jewel in the rough VernonDozier is a jewel in the rough VernonDozier is a jewel in the rough VernonDozier is a jewel in the rough 
Rep Power: 6
Solved Threads: 187
VernonDozier VernonDozier is offline Offline
Nearly a Posting Virtuoso

Re: Please Help Compiling Error

  #7  
Jul 23rd, 2008
Originally Posted by twgood View Post
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);
Reply With Quote  
Join Date: May 2008
Posts: 34
Reputation: twgood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
twgood twgood is offline Offline
Light Poster

Re: Please Help Compiling Error

  #8  
Jul 23rd, 2008
So if I make them the same it would work?
Reply With Quote  
Join Date: Jan 2008
Posts: 1,490
Reputation: VernonDozier is a jewel in the rough VernonDozier is a jewel in the rough VernonDozier is a jewel in the rough VernonDozier is a jewel in the rough 
Rep Power: 6
Solved Threads: 187
VernonDozier VernonDozier is offline Offline
Nearly a Posting Virtuoso

Re: Please Help Compiling Error

  #9  
Jul 23rd, 2008
Originally Posted by twgood View Post
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.
Reply With Quote  
Join Date: May 2008
Posts: 34
Reputation: twgood is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
twgood twgood is offline Offline
Light Poster

Re: Please Help Compiling Error

  #10  
Jul 23rd, 2008
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Java Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 12:00 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC