-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathF10.pas
More file actions
49 lines (39 loc) · 1.87 KB
/
F10.pas
File metadata and controls
49 lines (39 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Nama File: F10.pas
// Deskripsi File: Unit prosedur istirahat untuk program utama Engi's Kitchen
// Tanggal terakhir diubah: 22/04/2018
unit F10;
interface
{ Deklarasi Fungsi/Prosedur }
procedure istirahat(var energiawal:Longint; var countis:Integer );
{procedure ini menerima input energi chef saat ini dan countis. countis merupakan counter yang menghitung berapa kali chef telah
makan dalam sehari}
{I.S. energiawal = energi awal sebelum istirahat, diambil dari FESimulasi.tEnergi. Saat belum istirahat, countis=0}
{F.S. energi awal bertambah 1 jika masih bisa istirahat, countis akan bertambah satu setiap kali istirahat}
implementation
{ Implementasi Fungsi/Prosedur }
procedure istirahat(var energiawal:Longint; var countis:Integer );
{procedure ini menerima input energi chef saat ini dan countis. countis merupakan counter yang menghitung berapa kali chef telah
makan dalam sehari}
{I.S. energiawal = energi awal sebelum istirahat, diambil dari FESimulasi.tEnergi. Saat belum istirahat, countis=0}
{F.S. energi awal bertambah 1 jika masih bisa istirahat, countis akan bertambah satu setiap kali istirahat}
{KAMUS}
{ALGORITMA}
begin
if (countis < 6) then {Kondisi saat chef belum istirahat 6 kali}
begin
if (energiawal<10) then {Saat energi chef masih dibawah 10, maka energi chef akan bertambah 1}
begin
write('Energi chef sekarang: ');
energiawal:=energiawal+1; {Penambahan 1 energi pada energi chef}
writeln(energiawal); {Menuliskan energi setelah istirahat ke layar}
end else {Kondisi saat energi chef sudah 10 namun belum istirahat 6 kali}
begin
writeln('Sudah istirahat, tapi energi tidak nambah');
end;
countis:=countis+1; {Menghitung sudah berapa kali chef istirahat}
end else {Kondisi ketika chef sudah istirahat 6 kali}
begin
writeln('Istirahat tidak boleh >6 kali');
end;
end;
end.