ok so I have to make that toggleCircusStatus() gives me the opposite of fromCircus
Write a public method called toggleCircusStatus that negates the value of the circusStatus variable.
]
public class Elephant extends Mammal
{
private boolean fromCircus;
public Elephant()
{
super();
fromCircus = false;
}
public Elephant ( String n , int a , boolean C)
{
super(n,a);
fromCircus = C;
}
public String speak()
{
return "STAMP STAMP STAMP";
}
public String toString()
{
return "ELEPHANT\n" + super.toString() + "\nSOUND:\t" + speak() + "\nStatus:\t" + getCircusStatus();
}
private String getCircusStatus()
{
if(fromCircus = true)
return "Circus Elephant";
else
return "Wild Elephant";
}
public void toggleCircusStatus()
{//If it's true make it false and if it's false make it true.
if (fromCircus = true)
fromCircus = false;
if (fromCircus = false)
fromCircus = true;
}
}