My code in text editor:
program InvestmentCal;
uses TerminalUserInput, Math;
var
function CompoundInterest(principle, years: Integer; interest: Double): Double;
compound_interest: Double;
begin
compound_interest := principle * power(1 + interest, years) - principle;
result := compound_interest;
end;
procedure Main();
var
enterPrinciple, enterInterest, compound_interest: Double;
begin
enterPrinciple := ReadDouble('Enter principle: ');
enterInterest := ReadDouble('Enter interest: ');
Result from terminal:
Free Pascal Compiler version 2.6.4 [2014/02/26] for i386
Copyright (c) 1993-2014 by Florian Klaempfl and others
Target OS: Darwin for i386
Compiling InvestmentCal.pas
InvestmentCal.pas(8,51) Error: Identifier not found "interest"
InvestmentCal.pas(18,53) Error: Incompatible type for arg no. 1: Got "Double", expected "LongInt"
InvestmentCal.pas(29,4) Fatal: There were 2 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/local/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)
compound_interest := CompoundInterest(enterPrinciple, 5, enterInterest);
writeln('Compound interest is ', compound_interest);
end;
InvestmentCal.pas(8,51) Error: Identifier not found "interest"
refers to this line
compound_interest := principle * power(1 + interest, years) - principle;
what have i done wrong?