Constructor Errors (actual and formal argument lists differ in length)? -


i can't figure out why gives me error code no suitable constructor found for.

regularpie(string,string,string,string,string,string,double) super(thename, thecrust, thesize, thesauce, thecheese, thetopping, theprice); ^ constructor regularpie.regularpie(string,string,string,string,string) not applicable (actual , formal argument lists differ in length) constructor regularpie.regularpie() not applicable (actual , formal argument lists differ in length) process completed. 

whats wrong?

public class regularpie {      private string name;     private string size;     private string crust;     private string sauce;     private string cheese;       public regularpie()     {         name     = "regular pie";         crust    = "hand- tossed";         size     = "medium";         sauce    = "marinara";         cheese = "mozzarella";     }      public regularpie(string thename, string thecrust, string thesize, string thesauce, string thecheese)     {         if(thename ==null ||thecrust ==null ||thesize ==null ||thesauce ==null ||thecheese ==null)         {             system.out.println("pizza not created");             system.exit(0);         }         name     = thename;         crust    = thecrust;         size     = thesize;         sauce    = thesauce;         cheese = thecheese;      }      public string getname()     {         return name;     }         public string getcrust()     {         return crust;     }         public string getsize()     {         return size;     }         public string getsauce()     {         return sauce;     }         public string getcheese()     {         return cheese;     }     public void setname(string newname)     {         if (newname == null)         {             system.out.println("error name");             system.exit(0);         }         else         {             name = newname;         }     }     public void setcrust(string newcrust)     {         if (newcrust == null)         {             system.out.println("error crust");             system.exit(0);         }         else         {             crust = newcrust;         }     }     public void setsize(string newsize)     {         if (newsize == null)         {             system.out.println("error size");             system.exit(0);         }         else         {             size = newsize;         }     }     public void setsauce(string newsauce)     {         if (newsauce == null)         {             system.out.println("error suace");             system.exit(0);         }         else         {             sauce = newsauce;         }     }     public void setcheese(string newcheese)     {         if (newcheese == null)         {             system.out.println("error topping");             system.exit(0);         }         else         {             cheese = newcheese;         }     }      public string tostring()     {         return("you order " + name + " pizza, has " + crust + " crust, standard " + size + " size, " + sauce +" sauce, , " + cheese + " topping.");     }      public boolean equals(regularpie otherregularpie)     {         return (name.equals(otherregularpie.name)&&crust.equals(otherregularpie.crust)&&size.equals(otherregularpie.size)&&sauce.equals(otherregularpie.sauce)&&cheese.equals(otherregularpie.cheese));     }      public class specialone extends regularpie     {         private string topping;         private double price;      public specialone()     {         super();         topping = "";         price = 0;     }      public specialone(string thename, string thecrust, string thesize, string thesauce, string thecheese, string thetopping, double theprice)     {         super(thename, thecrust, thesize, thesauce, thecheese, thetopping, theprice);         topping = thetopping;         price = theprice;     }      public specialone(specialone originalobject)     {         super(originalobject);         topping = originalobject.topping;         price = originalobject.price;      }      public string gettopping()     {         return topping;     }     public double getprice()     {         return price;     }     public void settopping(string newtopping)     {         topping = newtopping;     }     public void setprice(double newprice)     {         price = newprice;     }      } } 

when call super(), invoking parrent's constructor. specialone invoking super() invokes constructor regularpie, passing 7 strings constructor , regularpie has no constructor accepts 7 strings. remove thetopping, theprice super() call in specialone. setting them explicitely in specialone constructor since members of class, not of base one.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -