Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with GNAT.IO; use GNAT.IO;
- with Piwa;
- package body Magazyn is
- function pobierz return Piwa.Piwo is
- begin
- if iloscSztuk > 0 then
- put_line(">> MAGAZYN: wyjmuje piwo(" & Integer'Image(iloscSztuk) & "/" & Integer'Image(pojemnosc) & ")");
- iloscSztuk := iloscSztuk - 1;
- else
- raise wyjatekMagazynu with "Magazyn jest pusty!";
- end if;
- return kontener(iloscSztuk + 1);
- end pobierz;
- procedure dodaj(piwko : in Piwa.Piwo) is
- begin
- if iloscSztuk < pojemnosc then
- put(">> MAGAZYN: dodaje piwo(" & Integer'Image(iloscSztuk + 1) & "/" & Integer'Image(pojemnosc) & "): ");
- put(Piwa.gatunki'Image(piwko.gatunek) & "" & Piwa.zawartoscAlkoholu'Image(piwko.moc) & "%");
- new_line(1);
- else
- raise wyjatekMagazynu with "Magazyn jest pelen!";
- end if;
- iloscSztuk := iloscSztuk + 1;
- kontener(iloscSztuk) := piwko;
- end dodaj;
- function sprawdzIloscSztuk return integer is
- begin
- return iloscSztuk;
- end sprawdzIloscSztuk;
- end Magazyn;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement