ITransaksi.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Chapter3 { interface ITransaksi { void Setor(int jumlah); void Tarik(int jumlah); } } IIdentitas.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Chapter3 { interface IIdentitas { int Id { get; set; } string Password { get; set; } int Saldo { get; set; } } } AkunPremium.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Chapter3 { public class AkunPremium : Akun { public AkunPremium(int id,int saldo, string password) : base(id,saldo,password) { Id = id; Password = password; Saldo = saldo; } public new int Saldo { get { return _saldo; } set { if (value < 0) throw new InvalidOperationException("Saldo tidak bisa kurang dari 0 rupiah"); else _saldo = value; } } public override void Setor(int jumlah) { Saldo += jumlah+500; } public override void Tarik(int jumlah) { Saldo -= jumlah+500; } } } Akun.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Chapter3 { public class Akun:IIdentitas,ITransaksi { private const int maxSaldo = 2000000; protected int _saldo; protected string password; public int Id { get; set; } public string Password { get { return password; } set { if (value.Length > 8) { password = value; } else { throw new InvalidOperationException("Password harus lebih dari 8 karakter"); } } } public int Saldo { get { return _saldo; } set { if (value < 0) throw new InvalidOperationException("Saldo tidak bisa kurang dari 0 rupiah"); else if (value > maxSaldo) throw new InvalidOperationException("Saldo tidak boleh melebihi 2000000 rupiah"); else _saldo = value; } } public Akun(int id,int saldo, string password) { Id = id; _saldo = saldo; Password = password; } public virtual void Setor(int jumlah) { Saldo += jumlah; } public virtual void Tarik(int jumlah) { Saldo -= jumlah; } public bool PasswordTervalidasi(string password) { if (this.password == password) return true; else return false; } } }