I have a problem with getting this right. All i get is unreachable code detected. I can run the program with that warning but it doesn't work correctly. What is it that i don't see?
this is the last part of my code:
class Account
{
private double balance = 0;
public Account()
{
}//end construcor
//Constructor initializes balance with an amount supplied as argument
public Account(double amount)
{
Balance = amount;
}// end constructor
//property to get and set the balance value
public double Balance
{
get
{
return balance;
}
set
{
balance = value;
}
}// end property
public void ShowMessage(string str)
{
Console.WriteLine(str);
}
public double Deposit(double depositAmount)
{
Balance += depositAmount * 1.05;
return Balance ;
}
public double Withdraw(double WithdrawAmount)
{
Balance -= WithdrawAmount;
return Balance;
if (WithdrawAmount > this.Balance)
this.ShowMessage("You do not have enough money!");
else
this.Balance -= WithdrawAmount;
return this.Balance;
}
}
}