Since you haven't actually asked a question, it is difficult to guess which of the many problems your code is showing you are complaining about.
However, given where the commented sections are, the problem is probably that the methods are doing nothing useful:
public void setfamily(String family)
{
String familyname = family;
}
Taking your comments out and looking at what you have:
1)
if(String.isempty())
will not work. Firstly, because there is no static method isempty associated with strings. Secondly, even if there were, it would need to know which string it should look at. Try using
if (String.IsNullOrEmpty(family))
This will check if the string exists, and if it is empty in one go.
2) What is
String familyname = family;
going to do? The variable "familyname" is set, and immediately goes out of scope, so is thrown away.
3) This isn't an error, but is strongly recommended for all new programmers: Do not rely on the if statement followed by a single line of code. Always, but always, use curly brackets to start and end a new block. Why? Because at some point you will add a line of code above the "return" in your code, and wonder why you code suddenly fails...
4) This also isn't an error, but is also a recommended practice, particularly when you start off: Try to keep to a single exit from all methods. In other words, reverse the condition, and execute the if-block when you have something to do. It makes it clearer what is happening, that's all.
5) Again, not an error: Be consistent in your naming conventions. If you use camelCase, use it throughout. "familyname" would be "familyName". Get used to doing it early, and it becomes second nature. Wait and learn it later means you have a habit to break.
6) Still not an error: Rather than creating loads of methods "setname", "setfamily" use properties instead. It is much more natural to see myClassInstance.Name = "Joe" than to see "myClassInstance.SetName("Joe");
So, your new method would be:
public string Family
{
get { return family; }
set
{
if(!String.IsNullOrEmpty(value))
{
family = value;
}
}
}
Sound like a lot of criticism? It isn't really; you haven't made a bad start, it's just there are things it is well worth doing properly from day 1. (And I didn't even
mention commenting!)
All in all, not a bad effort - you'll get there.