Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Aplicatia 1
- father(michael, john).
- father(rolmund, rolmund_jr).
- father(gion, giongion).
- father(john, john_ii).
- father(john, john_ii_copie).
- father(john_ii, john_iii).
- father(taticu_lor, michael).
- father(john, rolmund).
- child(X,Y) :- father(Y,X).
- brother(X,Y) :- father(T,X),father(T,Y),not(X=Y).
- nephew(X,Y) :- father(B,X),brother(Y,B).
- grandchild(X,Y) :- father(Z,X),father(Y,Z).
- predecesor(X,Y) :- father(X,Y);father(X,Z),predecesor(Z,Y).
- Aplicatia 2
- class('Vehicle').
- class('EnginePoweredVehicle').
- class('HumanPoweredVehicle').
- class('Car').
- class('Bus').
- class('Bicycle').
- inherits('EnginePoweredVehicle','Vehicle').
- inherits('HumanPoweredVehicle','Vehicle').
- inherits('Car','EnginePoweredVehicle').
- inherits('Bus','EnginePoweredVehicle').
- inherits('Bicycle','HumanPoweredVehicle').
- memberVariable('numberOfSeats',protected,int,'Vehicle').
- memberVariable('engineCapacity',public,int,'EnginePoweredVehicle').
- memberVariable('fuelConsumption',protected,float,'EnginePoweredVehicle').
- memberVariable('nameOfOwner',private,'java.lang.String','Car').
- memberVariable('nameOfOwnerCompany',private,'java.lang.String','Bus').
- memberVariable('numberOfGears',public,int,'Bicycle').
- brother_2(X,Y) :- inherits(X,T),inherits(Y,T),not(X=Y).
- ancestor(X,Y) :- inherits(X,Y);inherits(X,T),ancestor(T,Y).
- descendant(X,Y) :- inherits(Y,X);inherits(Y,T),descendant(X,T).
- containsPublicMemberVariables(X) :- memberVariable(_,A,_,X),A=public.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement