在 MortgageCalculationService.egl 檔案中的 amortize() 函數後面,新增下列程式碼。「記錄」是一個組件,所以您應在「服務」組件外部定義「記錄」組件,亦即在檔案中最後一個 end 陳述式的後面:
record MortgageCalculationResult
// user input
loanAmount MONEY;
interestRate DECIMAL(10,8);
term INT;
// calculated fields
monthlyPayment MONEY;
interest MONEY;
end