Results 1 to 3 of 3
Like Tree2Likes
  • 1 Post By awinston
  • 1 Post By Dex

Thread: Mutator Method help

  1. #1
    Dex
    Dex is offline Member
    Join Date
    Mar 2012
    Posts
    29
    Rep Power
    0

    Default Mutator Method help

    Hey ,

    How would i complete a mutator method that has multiple parameters.

    e.g

    Java Code:
    public void setRectangleOne(int x, int y, int w , int h){
    
    this.RectangleOne = // this is where i'm stuck
    
    }
    Thanks!

  2. #2
    awinston is offline Student
    Join Date
    Jul 2012
    Location
    United States
    Posts
    328
    Rep Power
    3

    Default Re: Mutator Method help

    I'm assuming that you want to construct a Rectangle object with a position of (x,y), a width of w, and a height of h, correct?

    All you have to do is call the constructor for Rectangle that has those 4 parameters: this one
    Dex likes this.
    "Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill

  3. #3
    Dex
    Dex is offline Member
    Join Date
    Mar 2012
    Posts
    29
    Rep Power
    0

    Default Re: Mutator Method help

    Thanks! my mistake was that I was using constructor.h , rather than constructor.height .. lol !
    awinston likes this.

Similar Threads

  1. Mutator methods
    By toterpunkt in forum New To Java
    Replies: 8
    Last Post: 02-24-2011, 09:17 AM
  2. Please help with mutator
    By ethemartian in forum New To Java
    Replies: 21
    Last Post: 02-06-2011, 02:57 AM
  3. Mutator method for a calculator
    By Krakatau7 in forum New To Java
    Replies: 15
    Last Post: 01-11-2011, 12:15 AM
  4. Accessor/Mutator Question
    By noble in forum New To Java
    Replies: 4
    Last Post: 02-02-2010, 05:21 AM
  5. mutator method
    By dirtycash in forum New To Java
    Replies: 7
    Last Post: 11-22-2007, 11:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •