0% found this document useful (0 votes)
31 views21 pages

Tugas Kelompok Program Komputer: Created by Gita, Yeni, Ela, Susi, Mega Kelas 2C Matematika

This document describes a program created by five students to calculate squares, factorials, and sums. The program contains four forms: 1. Form 1 is the main form and contains buttons to open the other forms and a timer to display the current date and time. 2. Form 2 calculates the sum and average of the squares of the first 20 even positive numbers. 3. Form 3 calculates the sum and average of the squares of the first 20 odd positive numbers. 4. Form 4 allows the user to input 15 numbers and calculates the factorials of each number and their sum.

Uploaded by

talia_zztt
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views21 pages

Tugas Kelompok Program Komputer: Created by Gita, Yeni, Ela, Susi, Mega Kelas 2C Matematika

This document describes a program created by five students to calculate squares, factorials, and sums. The program contains four forms: 1. Form 1 is the main form and contains buttons to open the other forms and a timer to display the current date and time. 2. Form 2 calculates the sum and average of the squares of the first 20 even positive numbers. 3. Form 3 calculates the sum and average of the squares of the first 20 odd positive numbers. 4. Form 4 allows the user to input 15 numbers and calculates the factorials of each number and their sum.

Uploaded by

talia_zztt
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

TUGAS

KELOMPOK
PROGRAM
KOMPUTER

Created By
Gita, Yeni, Ela, Susi, Mega
Kelas 2C Matematika
FORM 1
CODE EDITOR
PROCEDURE
TFORM1.JUMLAHKUADRATGENAPPOSITIF1CLICK(SENDER:
TOBJECT);
BEGIN
FORM2.SHOW;
END;

PROCEDURE
TFORM1.JUMLAHKUADRATGANJILPOSITIF1CLICK(SENDER:
TOBJECT);
BEGIN
FORM3.SHOW;
END;

PROCEDURE TFORM1.FAKTORIAL1CLICK(SENDER: TOBJECT);


BEGIN
FORM4.SHOW;
END;
PROCEDURE TFORM1.KELUAR1CLICK(SENDER: TOBJECT);
BEGIN
APPLICATION.TERMINATE;
END;

PROCEDURE TFORM1.TIMER1TIMER(SENDER: TOBJECT);


BEGIN
TIMER1.INTERVAL:=1;
LABEL1.LEFT:=LABEL1.LEFT+1;
IF LABEL1.LEFT>300 THEN
BEGIN
LABEL1.LEFT:=LABEL1.LEFT*0;
END
ELSE
TIMER1.INTERVAL:=1;
LABEL13.LEFT:=LABEL13.LEFT+1;
IF LABEL13.LEFT>300 THEN
BEGIN
LABEL13.LEFT:=LABEL13.LEFT*0;
END
END;

PROCEDURE TFORM1.TIMER2TIMER(SENDER: TOBJECT);


BEGIN
LABEL2.CAPTION:=('PADA TANGGAL '+DATETOSTR(NOW)+ ' PUKUL
'+TIMETOSTR(NOW));
END;
SETELAH DI RUN
FORM 2
Code Editor
procedure TForm2.BitBtn1Click(Sender: TObject);
var
x:array[2..40]of integer;
y:array[2..40]of integer;
z:array[2..40]of integer;
i:integer;
begin
x[2]:=2;
for i:=2 to 40 do
x[i]:=sqr(i);
y[i]:=(x[2]+x[4]+x[6]+x[8]+x[10]+x[12]+x[14]+x[16]+x[18]+x[20]+
x[22]+x[24]+x[26]+x[28]+x[30]+x[32]+x[34]+x[36]+x[38]+x[40]
);
z[i]:=y[i]div 20;
listbox1.Items.Add('Perhitungan Kuadrat 2 = '+inttostr(x[2]));
listbox1.Items.Add('Perhitungan Kuadrat 4 = '+inttostr(x[4]));
listbox1.Items.Add('Perhitungan Kuadrat 6 = '+inttostr(x[6]));
listbox1.Items.Add('Perhitungan Kuadrat 8 = '+inttostr(x[8]));
listbox1.Items.Add('Perhitungan Kuadrat 10 = '+inttostr(x[10]));
listbox1.Items.Add('Perhitungan Kuadrat 12 = '+inttostr(x[12]));
listbox1.Items.Add('Perhitungan Kuadrat 14 = '+inttostr(x[14]));
listbox1.Items.Add('Perhitungan Kuadrat 16 = '+inttostr(x[16]));
listbox1.Items.Add('Perhitungan Kuadrat 18 = '+inttostr(x[18]));
listbox1.Items.Add('Perhitungan Kuadrat 20 = '+inttostr(x[20]));
listbox1.Items.Add('Perhitungan Kuadrat 22 = '+inttostr(x[22]));
listbox1.Items.Add('Perhitungan Kuadrat 24 = '+inttostr(x[24]));
listbox1.Items.Add('Perhitungan Kuadrat 26 = '+inttostr(x[26]));
listbox1.Items.Add('Perhitungan Kuadrat 28 = '+inttostr(x[28]));
listbox1.Items.Add('Perhitungan Kuadrat 30 = '+inttostr(x[30]));
listbox1.Items.Add('Perhitungan Kuadrat 32 = '+inttostr(x[32]));
listbox1.Items.Add('Perhitungan Kuadrat 34 = '+inttostr(x[34]));
listbox1.Items.Add('Perhitungan Kuadrat 36 = '+inttostr(x[36]));
listbox1.Items.Add('Perhitungan Kuadrat 38 = '+inttostr(x[38]));
listbox1.Items.Add('Perhitungan Kuadrat 40 = '+inttostr(x[40]));
listbox1.Items.Add('==================================================
==============');
listbox1.Items.Add('Hasil Jumlah 20 Bilangan Genap Positif Pertama=
'+inttostr(y[i]));
listbox1.Items.Add('==================================================
==============');
listbox1.Items.Add('Rata-rata 20 Bilangan Genap Positif Pertama=
'+inttostr(z[i]));
listbox1.Items.Add('==================================================
==============');
end;

procedure TForm2.BitBtn2Click(Sender: TObject);


begin
listbox1.clear;
end;

procedure TForm2.BitBtn3Click(Sender: TObject);


begin
close;
end;
SETELAH DI RUN
FORM 3
Code Editor
procedure TForm3.BitBtn1Click(Sender: TObject);
var
a:array[1..39] of integer;
b:array[1..39] of integer;
c:array[1..39] of integer;
i:integer;
begin
a[1]:=1;
for i:=1 to 39 do
a[i]:=sqr(i);
b[i]:=(a[1]+a[3]+a[5]+a[7]+a[9]+a[11]+a[13]+a[15]+a[17]+a
[19]+a[21]+a[23]+a[25]+a[27]+a[29]+a[31]+a[33]+a[35]+a[3
7]+a[39]);
c[i]:=b[i] div 20;
listbox1.Items.add('Perhitungan Kuadrat 1 ='+inttostr(a[1]));
listbox1.Items.add('Perhitungan Kuadrat 3 ='+inttostr(a[3]));
listbox1.Items.add('Perhitungan Kuadrat 5 ='+inttostr(a[5]));
listbox1.Items.add('Perhitungan Kuadrat 7 ='+inttostr(a[7]));
listbox1.Items.add('Perhitungan Kuadrat 9 ='+inttostr(a[9]));
listbox1.Items.add('Perhitungan Kuadrat 11 ='+inttostr(a[11]));
listbox1.Items.add('Perhitungan Kuadrat 13 ='+inttostr(a[13]));
listbox1.Items.add('Perhitungan Kuadrat 15 ='+inttostr(a[15]));
listbox1.Items.add('Perhitungan Kuadrat 17 ='+inttostr(a[17]));
listbox1.Items.add('Perhitungan Kuadrat 19 ='+inttostr(a[19]));
listbox1.Items.add('Perhitungan Kuadrat 21 ='+inttostr(a[21]));
listbox1.Items.add('Perhitungan Kuadrat 23 ='+inttostr(a[23]));
listbox1.Items.add('Perhitungan Kuadrat 25 ='+inttostr(a[25]));
listbox1.Items.add('Perhitungan Kuadrat 27 ='+inttostr(a[27]));
listbox1.Items.add('Perhitungan Kuadrat 29 ='+inttostr(a[29]));
listbox1.Items.add('Perhitungan Kuadrat 31 ='+inttostr(a[31]));
listbox1.Items.add('Perhitungan Kuadrat 33 ='+inttostr(a[33]));
listbox1.Items.add('Perhitungan Kuadrat 35 ='+inttostr(a[35]));
listbox1.Items.add('Perhitungan Kuadrat 37 ='+inttostr(a[37]));
listbox1.Items.add('Perhitungan Kuadrat 39 ='+inttostr(a[39]));
LISTBOX1.ITEMS.ADD('=====================================
=========================');
LISTBOX1.ITEMS.ADD('HASIL JUMLAH 20 BILANGAN GANJIL
POSITIF PERTAMA='+INTTOSTR(B[I]));
LISTBOX1.ITEMS.ADD('=====================================
=========================');
LISTBOX1.ITEMS.ADD('RATA-RATA 20 BILANGAN GANJIL
POSITIF PERTAMA='+INTTOSTR(C[I]));
LISTBOX1.ITEMS.ADD('=====================================
=========================');
END;

PROCEDURE TFORM3.BITBTN2CLICK(SENDER: TOBJECT);


BEGIN
LISTBOX1.CLEAR;
END;

PROCEDURE TFORM3.BITBTN3CLICK(SENDER: TOBJECT);


BEGIN
CLOSE;
END;
SETELAH DI RUN
FORM 4
CODE EDITOR
var
Form4: TForm4;
a,i,jumlah:integer;
bilangan:array[1..15]of integer;
faktorial:array[1..15]of integer;
implementation
{$R *.dfm}

procedure TForm4.FormCreate(Sender: TObject);


begin
for i:=1 to 20 do
faktorial[i]:=1;
jumlah:=0;
a:=1;
edit1.text:=inttostr(a);
end;
PROCEDURE TFORM4.BITBTN1CLICK(SENDER: TOBJECT);
BEGIN
IF A<=15 THEN
BILANGAN[A]:=STRTOINT(EDIT2.TEXT);
FOR I:=2 TO BILANGAN[A] DO
FAKTORIAL[A]:=FAKTORIAL[A]*I;
IF A<15 THEN
A:=A+1;
EDIT1.TEXT:=INTTOSTR(A);
EDIT2.CLEAR;
EDIT2.SETFOCUS;
IF A=15 THEN
MESSAGEDLG('STOP DATA BILANGAN SUDAH 15
BUAH',MTWARNING,[MBOK],0);
END;

PROCEDURE TFORM4.BITBTN2CLICK(SENDER: TOBJECT);


BEGIN
FOR A:=1 TO 15 DO
LISTBOX1.ITEMS.ADD(INTTOSTR(BILANGAN[A])
+'!'+'='+INTTOSTR(FAKTORIAL[A]));
END;
PROCEDURE TFORM4.BITBTN3CLICK(SENDER: TOBJECT);
BEGIN
FOR A:=1 TO 15 DO
JUMLAH:=JUMLAH+BILANGAN[A];
FOR A:=1 TO 15 DO
LISTBOX2.ITEMS.ADD('BILANGAN KE'+INTTOSTR(A)
+'='+INTTOSTR(BILANGAN[A]));
LISTBOX2.ITEMS.ADD('JUMLAH BILANGAN:'+INTTOSTR(JUMLAH));
END;

PROCEDURE TFORM4.BITBTN4CLICK(SENDER: TOBJECT);


BEGIN
EDIT1.CLEAR;
EDIT2.CLEAR;
LISTBOX1.CLEAR;
LISTBOX2.CLEAR;
EDIT1.SETFOCUS;
END;

PROCEDURE TFORM4.BITBTN5CLICK(SENDER: TOBJECT);


BEGIN
CLOSE;
END;

END.
SETELAH DI RUN
THE END

Created By
Gita, Yeni, Ela, Susi ,
Mega
Kelas 2C Matematika

You might also like