Created
April 13, 2010 17:26
-
-
Save garretraziel/364851 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/gst -f | |
Object subclass: Zamestnanci[ | |
|seznam| | |
init [ | |
seznam := OrderedCollection new. | |
] | |
pridej: zamestnanec [ | |
seznam add: zamestnanec. | |
Transcript cr;cr. | |
] | |
odeber: zamestnanec [ | |
(seznam includes: zamestnanec) ifTrue: [seznam remove: zamestnanec] | |
ifFalse: [Transcript show: 'Neni takovy zamestanec!';cr;cr] | |
] | |
vypis [ | |
(1 to: seznam size) do: [:n|Transcript show: (seznam at: n);cr]. | |
Transcript cr;cr. | |
] | |
] | |
Zamestnanci class extend[ | |
new [ | |
|r| | |
r := super new. | |
r init. | |
^r. | |
] | |
] | |
Object subclass: Menu[ | |
|seznamZamestnancu| | |
init [ | |
seznamZamestnancu := Zamestnanci new. | |
] | |
zobraz [ | |
Transcript show: 'Stisknete'; cr. | |
Transcript show: '1 pro vypis'; cr. | |
Transcript show: '2 pro pridani'; cr. | |
Transcript show: '3 pro odebrani'; cr. | |
Transcript show: '0 pro konec'; cr; cr. | |
] | |
nacti [ | |
|nacteno| | |
nacteno := stdin nextLine. | |
Transcript cr;cr. | |
nacteno asInteger=1 ifTrue: [seznamZamestnancu vypis. self zobraz. self nacti]. | |
nacteno asInteger=2 ifTrue: [seznamZamestnancu pridej: stdin nextLine. self zobraz. self nacti]. | |
nacteno asInteger=3 ifTrue: [seznamZamestnancu odeber: stdin nextLine. self zobraz. self nacti]. | |
] | |
] | |
Menu class extend [ | |
new [ | |
|r| | |
r := super new. | |
r init. | |
^r | |
] | |
] | |
menu := Menu new. | |
menu zobraz. | |
menu nacti. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment