Java:error invalid method declaration; return type required

class TacoSupreme extends Taco
{
   private int sourCream;
   private int blackOlives;

   public TacoSupreme()
   {
      super(2,3,2,1);

      System.out.println("Making a default Taco");

      sourCream   = 1;
      blackOlives = 1;
   }

   public Taco(int bee, int bea, int che, int let, String nam, int sc, int bo)
    {
       super(bee, bea, che, let);

       System.out.println("Making a default TacoSupreme");

       sourCream   = sc;
       blackOlives = bo;
    }

    public void printTaco()
    {
       super.printTaco();
       System.out.println("sourCream   = " + sourCream);
       System.out.println("blackOlives = " + blackOlives);
    }

    public int weight()
    {
       return(super.weight() + sourCream + blackOlives);
    }

    public void gutBomb();
    {
       super.gutBomb();
       sourCream++;
       blackOlives++;
    }
}

public class Lab8
{
   public static void main(String args[] )
   {
      BufferedReader input = new BufferedReader(new InputStreamReader(System.in ));

      String input_string;
      String name;
      int beef;
      int beans;
      int cheese;
      int lettuce;
      int sourCream;
      int blackOlives;

      System.out.println("Custom Taco");

      System.out.println("Enter your name");
      name = input.readLine();
      System.out.println("name = " + name);

      System.out.println(" How much beef you want");
      input_string = input.readLine();
      beef = Integer.parseInt(input_string);

      System.out.println(" How much beans you want");
      input_string = input.readLine();
      beans = Integer.parseInt(input_string);

      System.out.println("How much cheese you want");
      input_string = input.readLine();
      cheese = Integer.parseInt(input_string);

      System.out.println("How much lettuce you want");
      input_string = input.readLine();
      lettuce = Integer.parseInt(input_string);
      
        System.out.println("PlUS!!!");

      System.out.println("How much sourCream you want");
      input_string = input.readLine();
      sourCream = Integer.parseInt(input_string);

      System.out.println("How much blackOlives you want");
      input_string = input.readLine();
      blackOlives = Integer.parseInt(input_string);

      System.out.println("The above taco supreme weight is: ");
      return(beef + beans + cheese + lettuce + sourCream + balckOlives);

      TacoSupreme t1 = new TacoSupreme(bee, bea, che, let, nam, bo, sc);
   }
}

Why does your TacoSupreme have a Taco constructor? A class can only have on constructor, given the class is TacoSupreme the only constructor which should be public TacoSupreme()

This topic was automatically closed 18 hours after the last reply. New replies are no longer allowed.