So, my challenge is this:
The constructor should call the base class constructor to initialize the account’s name, number, and balance. It should also call a method in its own class, setInterestRate, which should set the InterestRate variable and validate that the rate is a positive number. If the interest rate passed in is negative, set the interest rate to zero.
This seems fairly straightforward to me, but VS is pinging me for my setInteresteRate method (not all code paths return a value). I must be missing something, but I'm not sure what. Any suggestions? Here is my code:
public SavingsAccount(string AccountName, int AccountNumber, decimal Balance, double rate) : base(AccountName, AccountNumber, Balance)
{
InterestRate = rate;
}
public double setInterestRate(double rate)
{
if (rate >= 0)
{
InterestRate = rate;
}
else
{
InterestRate = 0;
}
}