Search:

Type: Posts; User: Vessel06

Search: Search took 0.09 seconds.

  1. [SOLVED] Re: Another question abt mutators and accessors...

    This is the current code giving the issue


    G1.setPet(C2);
    G2.setPet(C1);
    System.out.println(G1.getPet().getGname);


    The output I'm getting is " The Gorilla's name...
  2. [SOLVED] Re: Another question abt mutators and accessors...

    Ok...this is the prof's example/instruction "In your harness, check that your new accessor and mutator work. For instance, if you have a Gorilla koko and a Cat fluffy, you should be able to say

    ...
  3. [SOLVED] Re: Another question abt mutators and accessors...

    YOU SIR ROCK!!!! I passed in the right identifier

    public void setPet(Cat c) {
    this.pet = c;
    }

    Now the problem is to make sure it all runs in the harness when I give the...
  4. [SOLVED] Re: Another question abt mutators and accessors...

    But when I simply put

    public void setPet(c) {
    this.pet = c; //this is the error
    }
    Java gives another error stating that an identifier still needs to be made...unsure what I...
  5. [SOLVED] Re: Another question abt mutators and accessors...

    Is this what you meant?
    public void setPet(String Cat) {
    this.pet = Cat;
    }
    Because if so, Java gives and error stating "incompatible types required: Cat found: String"

    ---...
  6. [SOLVED] Re: Another question abt mutators and accessors...

    No I didn't change any of the variables
  7. [SOLVED] Re: Another question abt mutators and accessors...

    Ok that makes more sense but does it make a difference that the variable is like that because it's supposed to call on the cat class that is already written and correct since my prof checked it...
  8. [SOLVED] Re: Another question abt mutators and accessors...

    the setPet method in particular. maybe i'm misunderstanding the way the mutator works but I figured that


    public void setPet (String c) {
    this.pet = c;

    should work....but for some reason...
  9. [SOLVED] Another question abt mutators and accessors...

    ok same assignment(discussed in the question abt mutators) new problem, in my class gorilla, we have to give it a pet cat with the accessors and mutators for the pet cat in the gorilla class... this...
Results 1 to 9 of 9