Quick Java Question

Discussion in 'Mac Programming' started by RossMc, Jul 28, 2010.

  1. RossMc macrumors 65816

    RossMc

    Joined:
    Apr 30, 2010
    Location:
    Newcastle, UK
    #1
    Hi,

    Just wondering if someone could answer this for me.

    I need to write these three classes going off this UML diagram.

    [​IMG]


    I have wrote them all and the Room & MeetingRoom class's compile fine but on the Bedroom class this line shows up wrong.

    Bedroom(int, double, String)
    {

    }

    It says <identifier> expected.
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    Based only on that, I'd say name your parameters. Posting more code might help, though.

    -Lee
     
  3. jmuchrisf macrumors member

    Joined:
    Aug 25, 2007
    #3
    In your method signature, you supplied the argument types, but not variable names
     
  4. RossMc thread starter macrumors 65816

    RossMc

    Joined:
    Apr 30, 2010
    Location:
    Newcastle, UK
    #4
    This is the code I have

    Room

    MeetingRoom

    Bedroom

     
  5. rxvcgiii macrumors newbie

    Joined:
    Sep 15, 2008
    #5
    I believe jmuchrisf is correct. In "Bedroom", you provided the argument types, but no variable names.

    Try this instead:

    Bedroom(int a, double b, String s)
    {

    }
     
  6. RossMc thread starter macrumors 65816

    RossMc

    Joined:
    Apr 30, 2010
    Location:
    Newcastle, UK
    #6
    Thanks for the reply.

    I used the names from the Room class.
     

Share This Page