I'm after validation for these bellow with an explanation to what I'm trying to attempt for each one.
public void setPrice(int aPrice)throws DishException
{
if (aPrice < 0)
throw new DishException ("Price cannot not be a negative number");
price = aPrice;
}
Only accept numbers, and cannot be empty.
public void setType(char aType) throws DishException
{
if(aType == 0)
throw new DishException ("A dish type must be entered");
type = aType;
}
Only accept one letter from the following [s,m,d or S,M,D]
public void setName (String aName)throws DishException
{
if(aName.length() == 0)
throw new DishException ("A dish name must be entered");
name = aName;
}
Only allow words no numbers or symbols
Any help would be great B)