I am trying to make a class for a pet name, age, weight and if it is a dog or cat and the have to methods to calculate the dosage for Aceptomazine and Carprofen. I want to return a different value for both the Aceptomazine and Carprofen method for a cat and a dog but when I do it says Pet.Acropromazine: not all code paths return a value and the same error for the Carprofen method. I am not sure why it's doing this. any help would be appericated
class Pet
{
private string mName;
private int mAge;
private double mWeight;
private string mType;
public string Name
{
get { return mName; }
set
{
if (string.IsNullOrEmpty(value) )
{
mName = value;
}
else
{
throw new Exception("Name cannot be empty");
}
}
}
public int Age
{
get { return mAge; }
set
{
if (value > 1)
{
mAge = value;
}
else
{
throw new Exception("Age must be greater than 1");
}
}
}
public double Weight
{
get { return mWeight; }
set
{
if (value > 5)
{
mWeight = value;
}
else
{
throw new Exception("Age must be greater than 5");
}
}
}
public Pet()
{
mName = "Super Pet";
mType = "Dog";
mAge = 1;
mWeight = 5;
}
public double Acropromazine()
{
if (mType == "Dog")
{
return (mWeight / 2.205) * (0.03 / 10);
}
else if(mType =="Cat")
{
return (mWeight / 2.205) * (0.002/ 10);
}
}
public double Carprofen()
{
if (mType == "Dog")
{
return (mWeight / 2.205) * (0.5 / 10);
}
else if (mType == "Cat")
{
return (mWeight / 2.205) * (0.25 / 10);
}
}
}