Bismillahirrahmanirrahim.
Program Penghitungan Volume Benda dibuat menggunakan bahasa pemrograman pascal. Program ini bisa digunakan untuk menghitung volume sebuah benda dengan berbagai bentuk. Contohnya Akuarium, Bak Mandi, Tabung dll.
Program VolumeMath;
Uses Crt;
Const Phi = 3.14;
Var
panjang,lebar,tinggi,alas,jari : real;
Volume,rusuk : real;
pilih,I :integer;
Begin
Pilih := 1;
While pilih <> 0 Do
Begin
ClrScr;
Gotoxy(13,3); write ('MENGHITUNG VOLUME DENGAN PASCAL');
Gotoxy(13,4); write ('===============================');
Gotoxy(13,6); write ('1. Menghitung Volume Balok');
Gotoxy(13,7); write ('2. Menghitung Volume Kubus');
Gotoxy(13,8); write ('3. Menghitung Volume Prisma');
Gotoxy(13,9); write ('4. Menghitung Volume Tabung');
Gotoxy(13,10); write ('5. Menghitung Volume Limas');
Gotoxy(13,11); write ('6. Menghitung Volume Kerucut');
Gotoxy(13,12); write ('7. Menghitung Volume Bola');
Gotoxy(13,13); write ('0. Keluar dari Program');
Gotoxy(13,15); write ('Pilihan Anda?');
Read (pilih);
Case pilih of
1: Begin
clrscr; panjang := 0; lebar := 0; tinggi:= 0;
Gotoxy(13,3); Write('MENCARI VOLUME BALOK');
Gotoxy(13,4); Write('====================');
Gotoxy(13,6); Write('Panjang Balok = ');Readln(panjang);
Gotoxy(13,7); Write('Lebar Balok = ');Readln(lebar);
Gotoxy(13,8); Write('Tinggi Balok = ');Readln(tinggi);
Volume := panjang * lebar * tinggi;
Gotoxy(13,10); Write('Volume Balok = ', Volume:9:2);
Readkey;
End;
2: Begin
clrscr; rusuk := 0; rusuk := 0; rusuk :=0;
Gotoxy(13,3); Write('MENCARI VOLUME KUBUS');
Gotoxy(13,4); Write('====================');
Gotoxy(13,6); Write('Rusuk Kubus = ');Readln(rusuk);
Volume := rusuk * rusuk * rusuk;
Gotoxy(13,8); Write('Volume Kubus = ', Volume:9:2);
Readkey;
End;
3: Begin
clrscr; alas := 0; tinggi := 0;
Gotoxy(13,3); write('MENCARI VOLUME PRISMA');
Gotoxy(13,4); write('=====================');
Gotoxy(13,6); write('Alas Prisma = ');readln(alas);
Gotoxy(13,7); write('Tinggi Prisma = ');readln(tinggi);
Volume := alas * tinggi;
Gotoxy(13,9); write('Volume Prisma = ',Volume:9:2);
Readkey;
End;
4: Begin
clrscr; jari := 0; tinggi := 0;
Gotoxy(13,3); write('MENCARI VOLUME TABUNG');
Gotoxy(13,4); write('=====================');
Gotoxy(13,6); write('Jari-jari Tabung = ');readln(jari);
Gotoxy(13,7); write('Tinggi Tabung = ');readln(tinggi);
Volume := 2 * Phi * jari * jari + 2 * Phi * jari * tinggi;
Gotoxy(13,9); write('Volume Tabung = ',Volume:9:2);
Readkey;
End;
5: Begin
clrscr; alas := 0; tinggi := 0;
Gotoxy(13,3); write('MENCARI VOLUME LIMAS');
Gotoxy(13,4); write('====================');
Gotoxy(13,6); write('Alas Limas = ');readln(alas);
Gotoxy(13,7); write('Tinggi Limas = ');readln(tinggi);
Volume := 1/3 * alas * tinggi;
Gotoxy(13,9); write('Volume Limas = ',Volume:9:2);
Readkey;
End;
6: Begin
clrscr; alas := 0; tinggi := 0;
Gotoxy(13,3); write('MENCARI VOLUME KERUCUT');
Gotoxy(13,4); write('======================');
Gotoxy(13,6); write('Jari Kerucut = ');readln(jari);
Gotoxy(13,7); write('Tinggi Kerucut = ');readln(tinggi);
Volume := 1/3 * Phi * jari * jari * tinggi;
Gotoxy(13,9); write('Volume Kerucut = ',Volume:9:2);
Readkey;
End;
7: Begin
clrscr; alas := 0; tinggi := 0;
Gotoxy(13,3); write('MENCARI VOLUME BOLA');
Gotoxy(13,4); write('======================');
Gotoxy(13,6); write('Jari Bola = ');readln(jari);
Gotoxy(13,7); write('Panjang Bola = ');readln(panjang);
Volume := 4/3 * Phi * jari * jari;
Gotoxy(13,9); write('Volume Bola = ',Volume:9:2);
Readkey;
End;
End;
End;
End.
Untuk melihat penjelasan yang lebih detail mengenai script di atas, anda bisa
download makalahnya. Terima Kasih, Semoga Bermanfaat
Fastabiqul Khairaats.