Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > What's wrong ?

Reply
Thread Tools

What's wrong ?

 
 
FopZ
Guest
Posts: n/a
 
      04-26-2007
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!

 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      04-26-2007
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.

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.asp...neral/200704/1

 
Reply With Quote
 
 
 
 
Patricia Shanahan
Guest
Posts: n/a
 
      04-26-2007
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
 
Reply With Quote
 
rossum
Guest
Posts: n/a
 
      04-26-2007
On 26 Apr 2007 02:06:13 -0700, FopZ <(E-Mail Removed)> 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

 
Reply With Quote
 
Brandon McCombs
Guest
Posts: n/a
 
      04-28-2007
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

 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      04-28-2007
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
 
Reply With Quote
 
Brandon McCombs
Guest
Posts: n/a
 
      04-28-2007
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.
 
Reply With Quote
 
Tor Iver Wilhelmsen
Guest
Posts: n/a
 
      05-02-2007
På Sat, 28 Apr 2007 20:40:54 +0200, skrev Brandon McCombs <(E-Mail Removed)>:

> 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.
 
Reply With Quote
 
Tor Iver Wilhelmsen
Guest
Posts: n/a
 
      05-02-2007
På Thu, 26 Apr 2007 11:06:13 +0200, skrev FopZ <(E-Mail Removed)>:

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.
 
Reply With Quote
 
Patricia Shanahan
Guest
Posts: n/a
 
      05-02-2007
Tor Iver Wilhelmsen wrote:
> På Sat, 28 Apr 2007 20:40:54 +0200, skrev Brandon McCombs <(E-Mail Removed)>:
>
>> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Have I bought wrong product? enquirer Wireless Networking 2 06-10-2005 10:59 PM
Zero Config keeps connecting to the wrong AP =?Utf-8?B?ZGdyaWZmaXRo?= Wireless Networking 2 03-04-2005 05:52 PM
Is XML Doc wrong or is Schema wrong? (or both) Matthew XML 7 01-07-2005 10:05 PM
wrong connection status Peter Welk Wireless Networking 0 12-22-2004 03:26 PM
XP SP2 Wrong IP on connection D Wells Wireless Networking 3 12-09-2004 03:35 AM



Advertisments