public class BankAccount
{
private decimal _balance;
public BankAccount()
{
_balance = 0;
}
public BankAccount(decimal startingBalance)
{
_balance = startingBalance;
}
public decimal Balance
{
get { return _balance; }
}
public decimal Deposit(decimal amount)
{
_balance = _balance + amount;
return _balance;
}
public decimal GetBalance()
{
return _balance;
}
public decimal Withdraw(decimal amount)
{
_balance = _balance – amount;
return _balance;
}
}
code Part B :
class Machine1
{
virtual public string Getsound()
{
return “Beep beep beep”;
}
public string Makesound()
{
string message = Getsound();
Console.WriteLine(message);
Console.WriteLine();
Console.ReadLine();
return message;
}
}
class Machine2 : Machine1
{
override public string Getsound()
{
return “Beep bop bop”;
}
}
Code Part C :
public abstract class BankAccount
{
public decimal _balance = 0;
public decimal _interestrate= 0;
public decimal Balance
{
get { return _balance; }
}
public abstract decimal Deposit(decimal amount);
public abstract decimal GetBalance();
public abstract decimal Withdraw(decimal amount);
}
public class Saving : BankAccount
{
public Saving()
{
_balance = 1000;
_interestrate = 4;
}
public override decimal Deposit(decimal amount)
{
_balance = _balance + amount;
return _balance;
}
public override decimal GetBalance()
{
return _balance;
}
public override decimal Withdraw(decimal amount)
{
_balance = _balance – amount;
return _balance;
}
public decimal PostInterest()
{
decimal _interest = _balance * _interestrate / 100;
_balance = _balance + _interest;
return _balance;
}
}
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more