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!
Andrew Thompson - 26 Apr 2007 11:41 GMT
>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.

Signature
Andrew Thompson
http://www.athompson.info/andrew/
Patricia Shanahan - 26 Apr 2007 12:15 GMT
>> Hi
>
[quoted text clipped - 3 lines]
> 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
Brandon McCombs - 28 Apr 2007 05:18 GMT
>>> Hi
>>
[quoted text clipped - 6 lines]
> 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
Lew - 28 Apr 2007 13:41 GMT
>>>> Hi
>>>
[quoted text clipped - 9 lines]
> 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.

Signature
Lew
Brandon McCombs - 28 Apr 2007 19:40 GMT
>>>>> Hi
>>>>
[quoted text clipped - 12 lines]
> 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.
Tor Iver Wilhelmsen - 02 May 2007 22:15 GMT
På Sat, 28 Apr 2007 20:40:54 +0200, skrev Brandon McCombs <none@none.com>:
> 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.
Patricia Shanahan - 02 May 2007 23:20 GMT
> På Sat, 28 Apr 2007 20:40:54 +0200, skrev Brandon McCombs <none@none.com>:
>
[quoted text clipped - 4 lines]
> 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
rossum - 26 Apr 2007 15:38 GMT
>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
Tor Iver Wilhelmsen - 02 May 2007 22:21 GMT
På Thu, 26 Apr 2007 11:06:13 +0200, skrev FopZ <max2k@swissinfo.org>:
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.