My programming assignment for this week calls for two classes, one a driver class and the other (well I'm not sure what the name of the non-driver class is). This program is about cats and their claws (exciting stuff!!). The driver class is going to ask the user whether the cat has claws with the response being true or false. So below I've posted my non-driver class (will someone tell me what I should refer to that as?), and in my initial variable declarations at the top of the class, I defined declawed as a string and isDeclawed as a boolean. When I try to compile this class I get cannot find symbol; Symbol: variable True
So, my code thinks True is a variable while I intended for it to be a string.
Is there a better way to do what I'm trying to do?
And if not, how can I make this work?
//*****************************************
//This method assigns the clawed status.
public void setDeclawed(String declawed)
{
this.declawed=declawed;
} // end setDeclawed
//*****************************************
//This method sets the boolean of clawed status
public Boolean isDeclawed()
{
if (this.declawed.equals(True))
{
return true;
}
else
{
return false;;
};
} // end isDeclawed
//*****************************************
Hah, figured it out after posting. True needed quotes...

New Topic/Question
Reply




MultiQuote





|