//Copyright (c) 2002, Art Gittleman //This example is provided WITHOUT ANY WARRANTY //either expressed or implied. /* Defines a SavingsAccount class derived from BankAccount. */ using System; public class SavingsAccount : BankAccount { private double interestRate; public SavingsAccount(double amount, double rate) : base(amount) { interestRate = rate; } public void PostInterest() { double balance = GetBalance(); double interest = interestRate/100*balance; Deposit(interest); } //Add code for Exercise 10.9 public override BankAccount ReadAccount() { Console.Write("SavingsAccount initial amount: "); double amt = double.Parse(Console.ReadLine()); Console.Write("Interest: "); double rate = double.Parse(Console.ReadLine()); BankAccount acc = new SavingsAccount(amt, rate); return acc; } public override string ToString() { return " Interest = "+ this.interestRate + " balance = "+GetBalance(); } }