Solution to ES 96 Homework 5 Frame Hierarchy. """""""""""""""" The unindented word or phrase is the frame name, the indented text is the slot name. Slot values are only shown for ako and isa slots. Property Owner Manager Business Property ako Property Personal Property ako Property Physical Object location Manufactured Object ako Physical Object data of manufacture Furniture ako Manufactured Object Electrical Device ako Manufactured Object cord length power requirements Typewriter ako Electrical Device print element changeable fonts Personal Typewriter ako Typewriter ako Personal Object Personal Typewriter 1 Table ako Furniture legs Pedestal Table ako Table When Constructed Demons """"""""""""""""""""""" Typewriter power requirements { 120 VAC Two Phase} /* Assume in USA. */ Pedestal Table legs { return 1; } /* That's what a pedestal table is. */ When Requested Demons """"""""""""""""""""" Personal Property manager { return owner } /* Owner will not be known when constructed. */ Typewriter changeable fonts { if Typewriter."print element" = "golf ball" or Typewriter."print element" = "daisy wheel" then return true } Table legs { if undefined(legs) return 4} /* This would not be appropriate for a when-constructed demon since there are many tables with other than four legs. Only return 4 if no value written. */ Typewriter print element { if undefined( object."print element" ) and ( object.ako="Business Property" and object."date of manufacture" < 1955 ) or ( object.ako="Personal Property" and object."date of manufacture" < 1985 ) then return "piano key" if undefined( object."print element" ) and ( object.ako="Business Property" and object."date of manufacture" > 1955 and object."date of manufacture" < 1990 ) then return "golf ball" if undefined( object."print element" ) and ( object.ako="Business Property" and object."date of manufacture" > 1990 ) or ( object.ako="Personal Property" and object."date of manufacture" >= 1985 ) then return "daisy wheel" } /* The type of print element guessed from date of manufacture. "Piano keys" are used on old-fashion typewriters and most (all?) mechanical typewriters (which aren't represented in the frame hierarchy.) "Golf balls" were mostly used in IBM Selectric typewriters and were rarely used in home typewriters. */ Rules """"" if PrintStock.hasCarbon and ( Typewriter."print element" = "ink jet" or Typewriter."print element" = "thermal" ) then adequate(Typewriter,PrintStock):=False /* A "Carbon" is sheet of material coated with pressure-sensitive ink. It's put between two pieces of paper to make an extra copy, the extra copy is called a carbon copy. Since ink jet and thermal print elements don't exert much pressure they can't make carbons. */ if distance( Object.location, Outlet.location ) < Object."cord length" then powerAvailable(Object,Outlet) /* The rule above can be used with a typewriter instance but uses slots in the "Electrical Device" and "Physical Object" superclasses. */