Monday, June 14, 2010

Program Njowo's Calender (Pascal)

Berikut salah satu program yang menurut saya cukup unik dan mempunyai nilai luhur tinggi, setelah di edit 1-2 3 kali nah jadi deh....meskipun belum sempurna dan masih ada yang belum dihapus beberapa fungsi g guna tapi setidaknya patut dihargai, lumayan bantu-bantu yang belajar pascal dan yang membutuhkannya..

Kalender Jawa

Berikut listing dari program pascal


Program Kalender_jawa ;
Uses Wincrt ;
var
tanggal : integer ;
tahun : integer ;
Hari, pil, i, hitweton, bulan, jumlahhari : integer ;
zodiak, nama : String ;
Haribulan : array[1..12] of integer ;
hit1, hit2, hit3, totalhari, j : integer ;


Procedure Entry ;
Begin ;
Writeln ;
Writeln('Masukkan Data anda ') ;
writeln ;
Write(' Nama --> '); readln(nama) ;
Write(' Tanggal --> '); readln(tanggal) ;
if (tanggal>31) or (tanggal=0) then
Entry;

Write(' Bulan --> '); readln(bulan) ;
case bulan of
1 : if tanggal>31 then
Entry ;
2 : if tanggal>29 then
Entry ;
3 : if tanggal>31 then
Entry ;
4 : if tanggal>30 then
Entry ;
5 : if tanggal>31 then
Entry ;
6 : if tanggal>31 then
Entry ;
7 : if tanggal>31 then
Entry ;
8 : if tanggal>31 then
Entry ;
9 : if tanggal>30 then
Entry ;
10 : if tanggal>31 then
Entry ;
11 : if tanggal>30 then
Entry ;
12 : if tanggal>31 then
Entry ;

else
Entry ;
End ;
Write(' Tahun --> '); readln(tahun) ;
Writeln;
Write('Anda yakin sudah benar..(1. Inggih, 2. Mboten) ? = ') ;
readln(pil) ;
case pil of
1 : readln;
2 : Entry ;
else entry ;
End;


Writeln;
End;
Procedure proses ;
Begin
hitweton := tanggal mod 5 ;

case hitweton of
1 : Writeln('Maka weton anda Legi') ;
2 : Writeln('Maka weton anda Paing') ;
3 : Writeln('Maka weton anda Pon') ;
4 : Writeln('Maka weton anda Wage') ;
Else
Writeln('Maka weton anda Kliwon') ;
End ;

if ((bulan=3) and (tanggal>=21)) or (bulan=4) then
writeln('Zodiak Aries')
else if ((bulan=4) and (tanggal>=20)) or (bulan=5) then
writeln('Zodiak Taurus')
else if ((bulan=5) and (tanggal>=21)) or (bulan=6) then
writeln('Zodiak Gemini')
else if ((bulan=6) and (tanggal>=21)) or (bulan=7) then
writeln('Zodiak Cancer')
else if ((bulan=7) and (tanggal>=24)) or (bulan=8) then
writeln('Zodiak Leo')
else if ((bulan=8) and (tanggal>=23)) or (bulan=9) then
writeln('Zodiak Virgo')
else if ((bulan=9) and (tanggal>=23)) or (bulan=10) then
writeln('Zodiak Libra')
else if ((bulan=10) and (tanggal>=23)) or (bulan=11) then
writeln('Zodiak Scorpio')
else if ((bulan=11) and (tanggal>=22)) or (bulan=12) then
writeln('Zodiak Sagitarius')
else if ((bulan=12) and (tanggal>=22)) or (bulan=1) then
writeln('Zodiak Capricon')
else if ((bulan=1) and (tanggal>=20)) or (bulan=2) then
writeln('Zodiak Aquarius')
else if ((bulan=2) and (tanggal>=19)) or (bulan=3) then
writeln('Zodiak Pisces') ;


Haribulan[1] := 31 ;
Haribulan[2] := 28 ;
Haribulan[3] := 31 ;
Haribulan[4] := 30 ;
Haribulan[5] := 31 ;
Haribulan[6] := 30 ;
Haribulan[7] := 31 ;
Haribulan[8] := 31 ;
Haribulan[9] := 30 ;
Haribulan[10] := 31 ;
Haribulan[11] := 30 ;
Haribulan[12] := 31 ;

hit1 :=(tahun-1900) div 4;

Case bulan of

1 : if tahun mod 4=0 then hit2:=0
else hit2:=1 ;
2 : if tahun mod 4=0 then hit2:=31
else hit2:=32 ;
3 : hit2:=60 ;
4 : hit2:=91 ;
5 : hit2:=121 ;
6 : hit2:=152 ;
7 : hit2:=182 ;
8 : hit2:=213 ;
9 : hit2:=244 ;
10 : hit2:=274 ;
11 : hit2:=305 ;
12 : hit2:=335 ;

End ;

hit3:=tahun-1900;

totalhari:= hit1 +hit2 + tanggal + hit3 ;
{Writeln(totalhari);}
Hari := totalhari mod 7 ;


case hari of
1 : Writeln('Minggu');
2 : Writeln('Senin');
3 : Writeln('Selasa');
4 : Writeln('Rabu') ;
5 : Writeln('Kamis') ;
6 : Writeln('Jumat') ;
else
Writeln('Sabtu')
End;

End ;

Procedure thank ;
Begin Clrscr ;
Writeln ;
Writeln('========Terima Kasih ',nama,'==========') ;
End ;
Procedure ulang ;
Begin
Entry ;
Writeln('=========================================') ;
Proses ;
Writeln('=========================================') ;
Write('Ingin mencoba lagi..(1. Inggih, 2. Mboten) ? = ') ;
readln(pil) ;
case pil of
1 : ulang;
2 : readln;
else Clrscr ;
End;
End;
Begin
Writeln('=========================================') ;
Writeln('************NJOWO"S CALENDER*************') ;
Writeln('=========================================') ;
ulang ;
Writeln;
Writeln;
Writeln;
Writeln(' Credit by ->Fadhli R/98987');
Writeln;

Thank ;

End.

0 comments:

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Facebook Themes