Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

public class Animal { private String type; private String sound; public void set

ID: 1803498 • Letter: P

Question


public class Animal {
private String type;
private String sound;


public void set_type( String newtype)
{

type=newtype;
type="cow";
}



public String get_type()
{
return type;
}

public void set_sound (String newsound)
{

sound=newsound;
sound="moo"

}

public String get_sound(){
return sound;
}

}

When I use this class in my next class it gives me null as output. I cant figure out why my
set type and set sound methods are not working. My compiler is telling me that they
are not being used locally. Any help would be appreciated! Thanks!!!

Explanation / Answer

i think don't define method void.....make it string or...that return