predicates
car(symbol,real,integer,symbol,integer)
truck(symbol,real,integer,symbol,integer)
can_buy(real)
clauses
car(chrysler, 130000, 3, red, 12000).
car(ford, 90000, 4, gray, 25000).
car(datsun, 8000, 1, red, 30000).
truck(ford, 80000, 6, blue, 8000).
truck(datsun, 50000, 5, orange, 20000).
truck(toyota, 25000, 2, black, 25000).
can_buy(Cost) :- car(M1, C1, _, _, _), C1<=Cost, write(M1), nl.
can_buy(Cost) :- truck(M2, C2, _, _, _), C2<=Cost, write(M2), nl.