What's wrong ?

Discussion in 'Java' started by FopZ, Apr 26, 2007.

  1. FopZ

    FopZ Guest

    Hi

    I have to create the following project



    public class Messanger {



    publicMessanger () {
    // TODO implement constructor

    }

    public String getBye() {
    // TODO implement method
    return null;
    }


    public String getHello() {
    // TODO implement method
    return null;
    }

    public String getName() {
    // TODO implement method
    return null;
    }


    public void sayBye() {
    // TODO implement method

    }


    public void sayHello() {
    // TODO implement method

    }

    public void setName() {
    // TODO implement method


    }


    }




    My suggestion is this version:


    public class Messanger {

    private String name;
    private String bye;
    private String hello;


    public Messanger (String newName, String newHello, String newBye)
    {
    // TODO implement constructor

    name = newName;
    bye = newBye;
    hello = newHello;

    }

    public String getBye() {
    // TODO implement method
    return bye;
    }


    public String getHello() {
    // TODO implement method
    return hello;
    }

    public String getName() {
    // TODO implement method
    return name;
    }


    public void sayBye() {
    // TODO implement method
    System.out.println (bye + "!");
    }


    public void sayHello() {
    // TODO implement method
    System.out.println (hello + (" ") + name + ("!"));
    }

    public void setName(String newName) {
    // TODO implement method
    name = newName;

    }


    }


    I don't know how i can do it right. My version wasn't accepted by the
    tester.
    I hope someone can help!
     
    FopZ, Apr 26, 2007
    #1
    1. Advertising

  2. Andrew Thompson, Apr 26, 2007
    #2
    1. Advertising

  3. Andrew Thompson wrote:
    > FopZ wrote:
    >> Hi

    >
    > HI, Hi, hI, hi..
    >
    > I was looking at your problem, but if you cannot have
    > the sense to post once, and wait for an answer, you
    > will get no help from me.
    >


    Sometimes people expect their message to appear immediately, and think
    something went wrong if they don't see it. Note that all three postings
    were within a few minutes of each other.

    As far as the original question is concerned, there is a major piece
    missing.

    What is the class supposed to do?

    Patricia
     
    Patricia Shanahan, Apr 26, 2007
    #3
  4. FopZ

    rossum Guest

    On 26 Apr 2007 02:06:13 -0700, FopZ <> wrote:

    >I don't know how i can do it right. My version wasn't accepted by the
    >tester.
    >I hope someone can help!

    Please tell us exactly what problem you are having.

    - Does your code compile correctly?
    - Does you code run correctly?
    - Is there a difference between what you think your code should do
    and what it actually does?
    - Did the tested give you any reason or error messages explaining why
    your code was not accepted?

    We can help you better if you tell us more about what problems you are
    having.

    rossum
     
    rossum, Apr 26, 2007
    #4
  5. Patricia Shanahan wrote:
    > Andrew Thompson wrote:
    >> FopZ wrote:
    >>> Hi

    >>
    >> HI, Hi, hI, hi..
    >>
    >> I was looking at your problem, but if you cannot have the sense to
    >> post once, and wait for an answer, you will get no help from me.
    >>

    >
    > Sometimes people expect their message to appear immediately, and think
    > something went wrong if they don't see it. Note that all three postings
    > were within a few minutes of each other.


    You'll have to forgive Andrew. He has trouble interacting with people
    and assumes everyone is obnoxious like he is.

    >
    > As far as the original question is concerned, there is a major piece
    > missing.
    >
    > What is the class supposed to do?
    >
    > Patricia
     
    Brandon McCombs, Apr 28, 2007
    #5
  6. FopZ

    Lew Guest

    Brandon McCombs wrote:
    > Patricia Shanahan wrote:
    >> Andrew Thompson wrote:
    >>> FopZ wrote:
    >>>> Hi
    >>>
    >>> HI, Hi, hI, hi..
    >>>
    >>> I was looking at your problem, but if you cannot have the sense to
    >>> post once, and wait for an answer, you will get no help from me.
    >>>

    >>
    >> Sometimes people expect their message to appear immediately, and think
    >> something went wrong if they don't see it. Note that all three postings
    >> were within a few minutes of each other.

    >
    > You'll have to forgive Andrew. He has trouble interacting with people
    > and assumes everyone is obnoxious like he is.


    You'll have to forgive Brandon. He likes to make personal remarks about Andrew.

    --
    Lew
     
    Lew, Apr 28, 2007
    #6
  7. Lew wrote:
    > Brandon McCombs wrote:
    >> Patricia Shanahan wrote:
    >>> Andrew Thompson wrote:
    >>>> FopZ wrote:
    >>>>> Hi
    >>>>
    >>>> HI, Hi, hI, hi..
    >>>>
    >>>> I was looking at your problem, but if you cannot have the sense to
    >>>> post once, and wait for an answer, you will get no help from me.
    >>>>
    >>>
    >>> Sometimes people expect their message to appear immediately, and think
    >>> something went wrong if they don't see it. Note that all three postings
    >>> were within a few minutes of each other.

    >>
    >> You'll have to forgive Andrew. He has trouble interacting with people
    >> and assumes everyone is obnoxious like he is.

    >
    > You'll have to forgive Brandon. He likes to make personal remarks about
    > Andrew.
    >


    Just trying to make these java newsgroups a little less confrontational
    due to how Andrew thinks he is helping people when he really isn't.
     
    Brandon McCombs, Apr 28, 2007
    #7
  8. PÃ¥ Sat, 28 Apr 2007 20:40:54 +0200, skrev Brandon McCombs <>:

    > Just trying to make these java newsgroups a little less confrontational
    > due to how Andrew thinks he is helping people when he really isn't.


    comp.lang.java.*help* is non-confrontational. *programmer* is not for
    beginner questions and has a far less friendly atmosphere. By design.
     
    Tor Iver Wilhelmsen, May 2, 2007
    #8
  9. PÃ¥ Thu, 26 Apr 2007 11:06:13 +0200, skrev FopZ <>:

    Try using a parameterless constructor.

    > public String getBye() {
    > // TODO implement method
    > return bye;
    > }


    Try just returning the constant "Goodbye" here.

    > public String getHello() {
    > // TODO implement method
    > return hello;
    > }


    And the constant "Hello" here.

    > public void sayBye() {
    > // TODO implement method
    > System.out.println (bye + "!");
    > }


    You are using your variable here instead of using the getBye() method the
    tester probably prefers. You also omit getName().

    > public void sayHello() {
    > // TODO implement method
    > System.out.println (hello + (" ") + name + ("!"));
    > }


    Here too - use the methods not the variables. Presumably there is a second
    task where you should subclass the class and override some of the methods
    to return different values. Using the variables defeats that purpose of
    the test.
     
    Tor Iver Wilhelmsen, May 2, 2007
    #9
  10. Newsgroup charter: WAS: Re: What's wrong ?

    Tor Iver Wilhelmsen wrote:
    > PÃ¥ Sat, 28 Apr 2007 20:40:54 +0200, skrev Brandon McCombs <>:
    >
    >> Just trying to make these java newsgroups a little less
    >> confrontational due to how Andrew thinks he is helping people when he
    >> really isn't.

    >
    > comp.lang.java.*help* is non-confrontational. *programmer* is not for
    > beginner questions and has a far less friendly atmosphere. By design.


    Huh? I was here when this newsgroup was designed. There was NOTHING in
    the charter about it either being not for beginners or being unfriendly.

    If the Java newsgroup reorganization proposal had included a
    not-for-beginners less-friendly-by-design newsgroup, I would have both
    campaigned and voted against its creation.

    Even if I had lost on preventing its creation, I would have argued
    strongly for a name that would have warned people that it might be a
    less friendly, expert-only newsgroup.

    With its current name, .programmer looks like exactly what it was
    designed to be, and what I believe it should be, a newsgroup for Java
    programmers.

    Patricia
     
    Patricia Shanahan, May 2, 2007
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Salisha Khan
    Replies:
    1
    Views:
    11,684
    JohnFol
    Aug 1, 2003
  2. Replies:
    2
    Views:
    399
  3. Pial
    Replies:
    4
    Views:
    56,976
    Phatman
    Aug 27, 2010
  4. Paul Leventis

    Re: Quartus bug or wrong VHDL?

    Paul Leventis, Jun 24, 2003, in forum: VHDL
    Replies:
    0
    Views:
    2,501
    Paul Leventis
    Jun 24, 2003
  5. Matthew
    Replies:
    7
    Views:
    783
    Priscilla Walmsley
    Jan 7, 2005
Loading...

Share This Page