1--
2-- Copyright(C) 1998
3-- All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
4--
5-- Permission to use, copy, modify, and distribute this
6-- software and its documentation for EDUCATIONAL purposes
7-- and without fee is hereby granted provided that this
8-- copyright notice appears in all copies.
9--
10
11-- date : September 1, 1999.
12-- authorĀ : Salih Yurttas.
13-- adapted from John English's book.
14
15-- class_interest_account.adb
16
17
18package body Class_Interest_Account is
19
20 procedure Set_Rate(Rate : in Float) is
21 begin
22 The_Interest_Rate := Rate;
23 end Set_Rate;
24
25 procedure Calculate_Interest(The : in out Interest_Account) is
26 begin
27 The.Accumulated_Interest := The.Accumulated_Interest +
28 Balance(The) * The_Interest_Rate;
29 end Calculate_Interest;
30
31 procedure Add_Interest(The : in out Interest_Account) is
32 begin
33 Deposit(The,
34 The.Accumulated_Interest);
35 The.Accumulated_Interest := 0.00;
36 end Add_Interest;
37
38end Class_Interest_Account;