LATIHAN PASCAL :
Input program penguji_berat_badan_ideal pada program pascal 7.0, simpan pada Drive D atau pada flashdish :
latihan 1 :
Input program penguji_berat_badan_ideal pada program pascal 7.0, simpan pada Drive D atau pada flashdish :
latihan 1 :
Contoh Penghitungan Gajilatihan2 :
Ketentuan Soal :
1. Nama Di input
2. Jabatan di input ,
Jabatan Gaji Tunjangan
Direktur 3000000 10 % dari gaji
Manager 2000000 5% dari gaji
Karyawan 1000000 2% dari gaji
OB 800000 1% dari gaji
3. Dikenakan PPN 10 % dari gaji
4. Gaji Bersih didapat dari : gaji + tunjangan – PPn
Jawabannya:
Uses crt;
Var nama:string[20];jabatan:string;
Gaji:longint;
Tunj,ppn,gajibersih:real;
Begin
Clrscr;
Write(‘Nama Karyawan : ‘); readln(nama);
Write(‘Masukkan Jabatan : ‘); readln(jabatan);
If (jabatan=’Direktur’) or (jabatan=’direktur’) then
Begin
Gaji:=3000000;
Tunj:=0.1* gaji;
End
Else If (jabatan=’Manager’) or (jabatan=’manager’) then
Begin
Gaji:=2000000;
Tunj:=0.05* gaji;
End
Else If (jabatan=’Karyawan’) or (jabatan=’karyawan’) then
Begin
Gaji:=1000000;
Tunj:=0.1* gaji;
End
Else
Begin
Gaji:=800000;
Tunj:=0.1* gaji;
End;
Writeln(‘Gaji Bersih : Rp.‘,gaji);
Writeln(‘Tunjangan Jabatan : Rp.‘,tunj:9:2);
Ppn:=0.1*gaji;
Writeln(‘PPN 10 % : Rp.‘,ppn:9:2);
Total:=(gaji+total)-ppn;
Writeln(‘Total Gaji : Rp.‘,total:9:2);
Readln;
End.
program penguji_berat_badan_ideal;
uses crt;
var bb,tb:integer;
min,max:real;
nm,pil:string;
begin
repeat
begin
repeat
begin
clrscr;
textcolor(GREEN);
gotoxy(27,3); writeln('PENGUJI BERAT BADAN IDEAL');
gotoxy(28,4); writeln('MADE BY: (AYU) DIAH AFRIANTI RAHAYU PUTRI SURIPTO');
gotoxy(20,5); writeln('REKAYASA PERANGKAT LUNAK');
gotoxy(23,6); writeln('SMK BINA SARANA CENDEKIA BANDUNG');
writeln('================================================================================');
gotoxy(7,9); textcolor(18);writeln('PROGRAM AKAN TERULANG JIKA DATA YANG DIMASUKKAN TIDAK MEMUNGKINKAN');
gotoxy(15,8); writeln('HANYA UNTUK YANG MEMILIKI TINGGI BADAN >= 110 CM');
gotoxy(29,25);textcolor(18); writeln('FULLSCREEN : Alt+Enter');
gotoxy(15,11);textcolor(green); writeln('MASUKKAN NAMA ANDA : ');
gotoxy(44,11); readln(nm);
gotoxy(15,12); writeln('MASUKKAN BERAT BADAN ANDA : ');
gotoxy(48,12); writeln('Kg');
gotoxy(44,12); readln(bb);
gotoxy(15,13); writeln('MASUKKAN TINGGI BADAN ANDA :');
gotoxy(48,13); writeln('cm');
gotoxy(24,25); writeln('TEKAN ENTER JIKA ENTRI DATA SELESAI');
gotoxy(44,12); readln(tb);
CLRSCR;
gotoxy(27,3); writeln('PENGUJI BERAT BADAN IDEAL');
gotoxy(28,4); writeln('MADE BY: (AYU) DIAH AFRIANTI RAHAYU PUTRI SURIPTO');
gotoxy(20,5); writeln('REKAYASA PERANGKAT LUNAK');
gotoxy(23,6); writeln('SMK BINA SARANA CENDEKIA BANDUNG');
writeln('================================================================================');
gotoxy(25,9); writeln('NAMA ANDA : ',nm);
gotoxy(25,10); writeln('BERAT BADAN ANDA : ',bb); gotoxy(49,10); write('Kg');
gotoxy(25,11); writeln('TINGGI BADAN ANDA : ',tb); gotoxy(49,11); write('cm');
end;
until ((tb-100)-(0.1*(tb-100))>=0) and (tb>=110);
begin
max:=(tb-100)+0.1*(tb-100);
min:=(tb-100)-0.1*(tb-100);
if bb>max
then
begin textcolor(red); gotoxy(20,18); writeln('Anda Kelebihan Berat Badan. Diet Donkk..');end
else
if bb
else
begin textcolor(blue); gotoxy(25,16); writeln('Selamat. Berat Badan Anda Ideal');end
end;
textcolor(green); gotoxy(17,19); writeln('RENTANG BERAT BADAN IDEAL ANDA ANTARA ',min:0:1);
gotoxy(59,19); writeln(' sd ',max:0:1);
repeat gotoxy(30,21); writeln('MENGULANG? (y,t) :');
gotoxy(50,21); readln(pil); until (pil='t') or (pil='y');
end;
until (pil='t') or (pil='T');
end.
latihan3 :
uses crt;
var bb,tb:integer;
min,max:real;
nm,pil:string;
begin
repeat
begin
repeat
begin
clrscr;
textcolor(GREEN);
gotoxy(27,3); writeln('PENGUJI BERAT BADAN IDEAL');
gotoxy(28,4); writeln('MADE BY: (AYU) DIAH AFRIANTI RAHAYU PUTRI SURIPTO');
gotoxy(20,5); writeln('REKAYASA PERANGKAT LUNAK');
gotoxy(23,6); writeln('SMK BINA SARANA CENDEKIA BANDUNG');
writeln('================================================================================');
gotoxy(7,9); textcolor(18);writeln('PROGRAM AKAN TERULANG JIKA DATA YANG DIMASUKKAN TIDAK MEMUNGKINKAN');
gotoxy(15,8); writeln('HANYA UNTUK YANG MEMILIKI TINGGI BADAN >= 110 CM');
gotoxy(29,25);textcolor(18); writeln('FULLSCREEN : Alt+Enter');
gotoxy(15,11);textcolor(green); writeln('MASUKKAN NAMA ANDA : ');
gotoxy(44,11); readln(nm);
gotoxy(15,12); writeln('MASUKKAN BERAT BADAN ANDA : ');
gotoxy(48,12); writeln('Kg');
gotoxy(44,12); readln(bb);
gotoxy(15,13); writeln('MASUKKAN TINGGI BADAN ANDA :');
gotoxy(48,13); writeln('cm');
gotoxy(24,25); writeln('TEKAN ENTER JIKA ENTRI DATA SELESAI');
gotoxy(44,12); readln(tb);
CLRSCR;
gotoxy(27,3); writeln('PENGUJI BERAT BADAN IDEAL');
gotoxy(28,4); writeln('MADE BY: (AYU) DIAH AFRIANTI RAHAYU PUTRI SURIPTO');
gotoxy(20,5); writeln('REKAYASA PERANGKAT LUNAK');
gotoxy(23,6); writeln('SMK BINA SARANA CENDEKIA BANDUNG');
writeln('================================================================================');
gotoxy(25,9); writeln('NAMA ANDA : ',nm);
gotoxy(25,10); writeln('BERAT BADAN ANDA : ',bb); gotoxy(49,10); write('Kg');
gotoxy(25,11); writeln('TINGGI BADAN ANDA : ',tb); gotoxy(49,11); write('cm');
end;
until ((tb-100)-(0.1*(tb-100))>=0) and (tb>=110);
begin
max:=(tb-100)+0.1*(tb-100);
min:=(tb-100)-0.1*(tb-100);
if bb>max
then
begin textcolor(red); gotoxy(20,18); writeln('Anda Kelebihan Berat Badan. Diet Donkk..');end
else
if bb
else
begin textcolor(blue); gotoxy(25,16); writeln('Selamat. Berat Badan Anda Ideal');end
end;
textcolor(green); gotoxy(17,19); writeln('RENTANG BERAT BADAN IDEAL ANDA ANTARA ',min:0:1);
gotoxy(59,19); writeln(' sd ',max:0:1);
repeat gotoxy(30,21); writeln('MENGULANG? (y,t) :');
gotoxy(50,21); readln(pil); until (pil='t') or (pil='y');
end;
until (pil='t') or (pil='T');
end.
latihan3 :
Contoh Case …Of
perhitungan berat dan harga barang
Ketentuan soal :
1. Kualitas Barang di masukkan
Kualitas Harga Per Kg
A/a 1000
B/b 750
C/c 500
Uses crt;
Var
Berat,harga,hargaperkg:integer;
Kualitas:char;
Begin
Clrscr;
Write(‘ Massukkan Kualitas Buah [A/B/C] : ‘); readln(kualitas);
Write(‘ Berapa Kg berat yang di beli : ‘ ); readln(berat);
Case kualitas of
‘A’,’a’: hargaperkg:=1000;
‘B’,’b’: hargaperkg:=750;
‘C’,’c’: hargaperkg:=500;
Else
Begin
Hargaperkg:=0;
Writeln(‘Salah Input’);
End;
End;
Harga:=hargaperkg*berat;
Writeln(‘ Harga Per Kg : Rp.’,hargaperkg);
Writeln(‘ Harga Total : Rp.’,harga);
End.
PERTANYAAN : OUTPUT??? jangan lupa di kumpulkan y !!!!!
....SELAMAT MENGERJAKAN....