Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4606828
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:37:08+00:00 2026-05-22T00:37:08+00:00

I am doing this AntFarm project for my Java class. This project consists of

  • 0

I am doing this AntFarm project for my Java class. This project consists of different classes(Food, WorkerAnt, Queen) and they interact with each other using a interface(with a method called process).

http://ljhs.sandi.net/faculty/volger/apajava/GridWorld/Assignments/AntFarm/ – project

I’m currently stuck on the processActors() method in WorkerAnt. (It’s almost at the bottom of the page.)

The current code is the following:

public void processActors(ArrayList<Actor> actors) {
  for (Actor nextActor : actors) {
    nextActor.process(this); 
  }
}

The error I get is the following.

Cannot find symbol symbol: method process(WorkerAnt)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:37:09+00:00Added an answer on May 22, 2026 at 12:37 am

    Going by the linked assignment, Actor does not have a process(WorkerAnt) method.

    Instead, this is part of the Processable interface (and thus Food).

    As such, make sure your Actor is an Actor implementing Processable (for example a Food).

    Ideally you’d change your processActors(ArrayList<Actor> actors) method to be something like processProcessables(ArrayList<Processable> processables).

    However, I see in the assignment that you are required to implement a processActors(ArrayList<Actor> actors) so you can’t really do this (although I’m going to call this out as bad design – it’s akin to having a method divide(object, object) instead of divide(double, double)).

    To see why it is bad design, the assignment says

    processActors: Each actor in actors needs to call its process method.

    Except Actors don’t have process methods – Processables do, and Actors are not Processable.

    In any case, you will have to settle for the fact that you expect some Actors to be Processables and do something like this:

    for(Actor nextActor : actors)
    {
        if (nextActor instanceof Processable)
            ((Processable)nextActor).process(this); 
    }
    

    However, you should have realised this from the assignment:

    An Actor could be a QueenAnt, a Cake,
    a Cookie, or a WorkerAnt. Without the
    Processable interface, processActors
    would need to determine the type of
    actor and then downcast the actor
    reference before making the call to
    process. But, since each of these
    classes implements Processable,
    processActors only needs to cast the
    actor to Processable before the call.
    This polymorphic processing is allowed
    because Processable contains the
    process abstract method. The Java Run
    Time Environment (JRE) determines the
    actual type of object at runtime and
    calls the appropriate process method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im doing this project where i need to download files through a webservice (images,
As I am currently doing this project in only C, I've up untill this
I'm doing this: return this.each(function(){ $.this.load('searchInterface.html',function(){ console.log('load'); //a lot of code }); $('#more_button').bind('click',more()); function
i'm doing this project Banking System This system tracks customers’ accounts in a bank.
[I am doing this work in Java, but I think the question is language-agnostic.]
Hopefully this is a quickie: I've been doing a lot of Java/Google Web Toolkit
I'm doing this to learn about class creation and to test geometry routines. As
I'm probably doing this wrong, so please be nice. I'm developing a Java game,
Would doing this be consider good practice... I have class A with the following
When doing this : class MyClass { public $myAttr; } $c = new MyClass();

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.