Btn;
lbedMinPeriod: TLabeledEdit;
Chart: TChart;
lbedMaxNalog: TLabeledEdit;
lbedStepNalog: TLabeledEdit;
lbedMaxPeriod: TLabeledEdit;
lbedStepPeriod: TLabeledEdit;
Timer1: TTimer;
procedure BitBtn1Click (Sender: TObject);
procedure Timer1Timer (Sender: TObject);
procedure lbedMaxNalogKeyPress (Sender: TObject; var Key: Char);
private
MaxP, MinP, Period, StepP: Integer;
function Postupleniya (Nalog, Rentab, Capital: Double; years: integer): Double;
{Private declarations}
public
{Public declarations}
end;
var
Form1: TForm1;
implementation
{$ R *. dfm}
{TForm1}
function TForm1.Postupleniya (Nalog, Rentab, Capital: Double;
years: integer): Double;
var
Pribil, PribilVNalog, OstPribili, Kapital: Double;
begin
Result: = 0.0;
while years> 0 do
begin
dec (years);
Pribil: = Capital * Rentab/100;
PribilVNalog: = Pribil * Nalog/100;
OstPribili: = Pribil-PribilVNalog;
Capital: = Capital + OstPribili;
Result: = Result + PribilVNalog;
end;
end;
procedure TForm1.BitBtn1Click (Sender: TObject);
var
MinNalog, MaxNalog, StepNalog, Rent, DohodVBudget,
StavkaNaloga, NachKapital, MinRentab,
MaxRentab, StepRent: Double;
i: integer;
begin
for i: = 0 to ComponentCount-1 do
if Components [i] is TLabeledEdit then
if TLabeledEdit (Components [i]). Text ='' then
begin
Timer1.Enabled: = false;
Exit;
end;
MinNalog: = StrToFloat (lbedMinNalog.Text);
MaxNalog: = StrToFloat (lbedMaxNalog.Text);
StepNalog: = StrToFloat (lbedStepNalog.Text);
NachKapital: = StrToFloat (lbedStartCapital.Text);
MaxRentab: = StrToFloat (lbedMaxRent.Text);
MinRentab: = StrToFloat (lbedMinRent.Text);
StepRent: = StrToFloat (lbedStepRent.Text);
MinP: = StrToInt (lbedMinPeriod.Text);
MaxP: = StrToInt (lbedMaxPeriod.Text);
StepP: = StrToInt (lbedStepPeriod.Text);
Timer1.Enabled: = true;
with Chart do
begin
SeriesList.Clear;
Legend.LegendStyle: = lsSeries;
Title.Text.Strings [0]: = IntToStr (Period) + 'років';
Rent: = MinRentab;
while Rent <= MaxRentab do
begin
AddSeries (TLineSeries.Create (Self));
Series [SeriesCount-1]. Title: = FloatToStr (Rent) + '%';
StavkaNaloga: = MinNalog;
while StavkaNaloga <= MaxNalog do
begin
DohodVBudget: = Postupleniya (StavkaNaloga, Rent, NachKapital, Period);
Series [SeriesCount-1]. AddXY (StavkaNaloga, DohodVBudget,'');
StavkaNaloga:...