What is wrong ?

F

FopZ

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!
 
E

Eric Sosman

FopZ wrote On 04/26/07 04:55,:
Hi

I have to create the following project
[... class with skeleton methods ...]
[... class with filled-in methods ...]

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

We can't tell you how to "do it right" until you reveal
what "it" is, that is, what the class and its methods are
supposed to do. And did the tester give any reason for
rejection, or did it just say "Bzzzt!"?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top