CurrentYield double = 0
end
methods
function b = Bonds(description,facevalue,yield)
if nargin == 0
description = '';
facevalue = 0;
yield = 0;
end
b.Description = description;
b.FaceValue = facevalue;
b.Yield = yield;
b.Type = AssetTypes.Bonds;
end
function mv = getCurrentValue(b)
y = b.Yield;
cy = b.CurrentYield;
if cy <= 0 || y <= 0
mv = b.FaceValue;
else
mv = b.FaceValue*y/cy;
end
end
function r = get.CurrentYield(b)
% Implement web access to obtain
% Current yield for this bond
% Returning dummy value
r = 0.24;
end
end
endCash Class
The Cash class represents a specific type of financial asset. It is a concrete class that
implements the abstract members defined by the Assets class and defines class
properties and methods specific to this type of asset.PropertiesThe Cash class defines these properties:- Amount — The amount of cash held in this asset.
20 Designing Related Classes