WXME0107 ## .wxtextwxtabwxmediawximage"(lib "syntax-browser.ss" "mrlib")drscheme:number$(lib "comment-snip.ss" "framework")+(lib "collapsed-snipclass.ss" "framework")drscheme:sexp-snip!(lib "bullet-snip.ss" "browser")drscheme:bindings-snipclass%$(lib "cache-image-snip.ss" "mrlib")drscheme:lambda-snip%gb:core gb:canvasgb:editor-canvas gb:slider gb:gauge gb:listbox gb:radiobox gb:choicegb:text gb:message gb:button gb:checkboxgb:vertical-panel gb:panelgb:horizontal-panel!(lib "readable.ss" "guibuilder")java-comment-box%java-interactions-box%make-line-snipmake-line-snip example-box%interactions-box%-(lib "image-snipr.ss" "slideshow" "private")drscheme:pict-value-snip%&(lib "pict-snipclass.ss" "slideshow")"drscheme:vertical-separator-snip%wxbaddrscheme:xml-snip(lib "xml-snipclass.ss" "xml")drscheme:scheme-snip"(lib "scheme-snipclass.ss" "xml")test-case-box% text-box%wxloc4K ZZ StandardK Andale Mono ZZ???????framework:default-color????????\???""Matching Parenthesis Style?\???""????&&(framework:syntax-coloring:scheme:symbol????&&)framework:syntax-coloring:scheme:keyword????&&????t)framework:syntax-coloring:scheme:comment????t????)&(framework:syntax-coloring:scheme:string????)&*framework:syntax-coloring:scheme:constant????)&????<$-framework:syntax-coloring:scheme:parenthesis????<$????'framework:syntax-coloring:scheme:error????????'framework:syntax-coloring:scheme:other????????Qp1drscheme:check-syntax:lexically-bound-identifier????Qp????D*drscheme:check-syntax:imported-identifier????D$honu:syntax-coloring:scheme:keyword????(honu:syntax-coloring:scheme:parenthesis????<$????""#honu:syntax-coloring:scheme:string????""$honu:syntax-coloring:scheme:literal????""$honu:syntax-coloring:scheme:comment????t"honu:syntax-coloring:scheme:error????'honu:syntax-coloring:scheme:identifier????&&$honu:syntax-coloring:scheme:default????%profj:syntax-coloring:scheme:keyword????$profj:syntax-coloring:scheme:string????""%profj:syntax-coloring:scheme:literal????""%profj:syntax-coloring:scheme:comment????t#profj:syntax-coloring:scheme:error????(profj:syntax-coloring:scheme:identifier????&&%profj:syntax-coloring:scheme:default????F???????XMLF????????????]???????G???????????G????G????d????K Andale Mono ZZ,%/* Homework #7% % Sample Solutions% % %> 1. The question asked you to modify sub questions 4 and 7, % %- not the provided code of the classes. % % (5.1.4) ((Chair)f).hasWheels% % (5.1.7) ((Larger)myL).first% % %> 2. This question asked you to fix the program by modifying % %A EnglishSpanishDictionary only. It is safe to typecast here % %D because we create the Dictionary and know that the Dictionary % %C only contains Lookups of concrete type Definition. If Lookup % %F could have been something other than Definition, we may have to % %D reexamine the situation to make sure that it is still safe to % % typecast.% % %...% % % class EnglishSpanishDictionary {% % ...% % %; //new EnglishSpanishDictionary().lookup("cat") -> "gato"% %, //To return the meaning of the given word% %! String lookup( String word ) {% %8 // ... this.word ... this.words.DictionaryMethod()% %E return ((Definition)this.words.returnValue(word)).getMeaning();% % }% %}% % %3. % % */ "class 'Book "{  'Writer 'author(;  'St'ring 'title(;  "int 'numPages(, ' printDate(, 'edition(;    'Book"( 'Writer 'author(, 'String 'title(, "int 'numPages(, "int ' printDate(, "int 'edition ") "{  "this(.'author"='author(;  "this(.'title "= 'title(;  "this(.'numPages "= 'numPages(;  "this(.' printDate "= ' printDate(;  "this(.'edition "= 'edition(;  "}   %I// new Book(new Writer("Cervantes", 1547), "Don Quixote", 100, 1960, 16).%  %Z// equals(new Book(new Writer("Cervantes", 1547), "Don Quixote", 100, 1960, 16)) == true%  %I// new Book(new Writer("Cervantes", 1547), "Don Quixote", 100, 1960, 16).%  %[// equals(new Book(new Writer("Cervantes", 1865), "Don Quixote", 100, 1960, 16)) == false%  %I// new Book(new Writer("Cervantes", 1547), "Don Quixote", 100, 1960, 16).%  %[// equals(new Book(new Writer("Cervantes", 1547), "Don Quixote", 100, 1960, 12)) == false%  %6// Determine if another book is the same as this book %  %// %A %*(though not necessarily the same instance)%  "boolean 'equals"('Object 'o") "{ A A %$// ... this.author.WriterMethod() ..%#. this.title ... this.numPages ... %  A %&// ... this.printDate ... this.edition% A A 'Book 'b "= "('Book")'o(; A A "return "this(.'author(.'equals"('b(.'author") "&& "this(.'title(.'equals"('b(.'title") "&&  A  A  "this(.'numPages "== 'b(.'numPages "&& "this(.' printDate "== 'b(.' printDate "&& A  A  "this(.'edition "== 'b(.'edition(;  "} "}  "class 'Writer "{  'String 'name(;  "int ' birthyear(;    'Writer"( 'String 'name(, "int 'birth ") "{ A A "this(.'name "= 'name(; A A "this(.' birthyear "= 'birth(;  "}    %L// new Writer("Faulkner", 1897).equals(new Writer("Faulkner", 1897)) == true%  %N// new Writer("Rehnquist", 1924).equals(new Writer("Faulkner", 1897)) == false%  %N// new Writer("Rehnquist", 1924).equals(new Writer("Faulkner", 1924)) == false%  %O// new Writer("Rehnquist", 1924).equals(new Writer("Rehnquist", 1897)) == false%  %9// Determine if another Writer is the same as this Writer%  "boolean 'equals"('Object 'o") "{ A A %'// ... this.name ... this.birthyear ...% A A 'Writer 'w "= "('Writer")'o(; A A "return "this(.'name(.'equals"('w(.'name") "&& "this(.' birthyear "== 'w(.' birthyear(;  "}   "}  ,&9new Book(new Writer(  "Cervantes", 1547),  "Don Quixote", 100, 1960, 16).  equals(new Book(new Writer(  "Cervantes", 1547),  "Don Quixote", 100, 1960, 16))true& ,&9new Book(new Writer(  "Cervantes", 1547),  "Don Quixote", 100, 1960, 16).  equals(new Book(new Writer(  "Cervantes", 1865),  "Don Quixote", 100, 1960, 16))false& ,&9new Book(new Writer(  "Cervantes", 1547),  "Don Quixote", 100, 1960, 16).  equals(new Book(new Writer(  "Cervantes", 1547),  "Don Quixote", 100, 1960, 12))false& & ,&new Writer(  "Faulkner", 1897).equals(new Writer(  "Faulkner", 1897))true& ,&new Writer(  "Rehnquist", 1924).equals(new Writer(  "Faulkner", 1897))false& ,&new Writer(  "Rehnquist", 1924).equals(new Writer(  "Faulkner", 1924))false& ,&new Writer(  "Rehnquist", 1924).equals(new Writer(  "Rehnquist", 1897))false&  %/* 4. CHALLENGE, 5. */ "abstract "class ' PersonList "{  %:// Determine if another Object is equal to this PersonList%  "abstract' "boolean 'equals"('Object 'o")(;   %W// Determine number of Persons (including descendant) with givenName in this PersonList%  "abstract' "int 'numNamed"('String ' givenName")(; "}  "class 'EmptyPL "extends ' PersonList "{    %.// new EmptyPL().equals(new EmptyPL()) == true%  %f// new EmptyPL().equals(new LargerPL(new Person("John", new EmptyPL()), new EmptyPL())) Runtime Error!%  %7// Determine if another Object is equal to this EmptyPL%  "boolean 'equals"('Object 'o") "{ A A 'EmptyPL 'empty "= "('EmptyPL")'o(; A A "return $true(;  "}   %%// new EmptyPL().numNamed("Joe") == 0%  %M// Determine the number of Persons in this EmptyPL, including all descendants%  "int 'numNamed"('String ' givenName") "{ A A %// ...% A A "return $0(;  "} "}  "class 'LargerPL "extends ' PersonList "{  'Person 'first(;  ' PersonList 'rest(;   'LargerPL"( 'Person 'first(, ' PersonList 'rest ") "{ A A "this(.'first "= 'first(; A A "this(.'rest "= 'rest(;  "}   %/* new LargerP%XL(new Person("John", new EmptyPL()), new EmptyPL()).equals(new EmptyPL()) Runtime Error!% %v new LargerPL(new Person("Greg", new LargerPL(new Person("Bob", new EmptyPL()), new EmptyPL())), new EmptyPL()).% %p equals(new LargerPL(new Person("Greg", new LargerPL(new Person("Bob", new EmptyPL()), new EmptyPL())), % %4 new EmptyPL())) == true% %v new LargerPL(new Person("Greg", new LargerPL(new Person("Bob", new EmptyPL()), new EmptyPL())), new EmptyPL()).% %p equals(new LargerPL(new Person("Greg", new LargerPL(new Person("Joe", new EmptyPL()), new EmptyPL())), % %5 new EmptyPL())) == false% % */  %8// Determine if another Object is equal to this LargerPL%  "boolean 'equals"('Object 'o") "{ A A 'LargerPL 'list "= "('LargerPL")'o(; A A "return "this(.'first(.'equals"('list(.'first") "&& "this(.'rest(.'equals"('list(.'rest")(;  "}   %/*% %v new LargerPL(new Person("Greg", new LargerPL(new Person("Bob", new EmptyPL()), new EmptyPL())), new EmptyPL()).% % % numNamed("Bob") == 1% %U new LargerPL(new Person("Greg", new LargerPL(new Person("Bob", new EmptyPL()),% %u new LargerPL(new Person("Greg", new EmptyPL()), new EmptyPL()))),% %A %A %d new LargerPL(new Person("Greg", new LargerPL(new Person("Greg", new EmptyPL()), new EmptyPL())),% %A %A %6 new EmptyPL())).numNamed("Greg") == 4% % */   %N// Determine the number of Persons in this LargerPL, including all descendants%  "int 'numNamed"('String ' givenName") "{ A A %O// ... this.first.PersonMethod() ... this.rest.PersonListMethod() ... givenName% %A %A "int 'remainingWithName "= this(.'first(.'numDescendantsWithName"(' givenName") "+ "this(.'rest(.'numNamed"(' givenName")(;% A A "if "(this(.'first(.' sameNameAs"(' givenName"))  A  A  "return $1 "+ 'remainingWithName(; A A "else A  A  "return 'remainingWithName(;  "} "}  "class 'Person "{  'String 'name(;  ' PersonList 'kids(;    'Person"( 'String 'name(, ' PersonList 'kids ") "{ A "this(.'name "= 'name(; A "this(.'kids "= 'kids(;  "}   %/* %new% %Person%(%"Joe"%,% %new% %LargerPL%(%new% %Person%(%"Jan"%,% %new% %LargerPL%(%new% %Person%(%"Joe"%,% %new% %EmptyPL%())%,% %new% %EmptyPL%()))%,% %$ %new% %LargerPL%(%new% %Person%(%"Mario"%,% %new% %LargerPL%(%new% %Person%(%"Joe"%,% %new% %EmptyPL%())%,% % %R %new% %LargerPL%(%n%e%w% %P%e%r%s%o%n%(%"Joe"%,% %n%e%w% %E%m%p%t%y%P%L%())%,% % %_ %new% %EmptyPL%())))%,% % %1 %new% %LargerPL%(%new% %Person%(% "Winston"%,% %new% %EmptyPL%())%,% % %> %new% %LargerPL%(%new% %Person%(%"Joe"%,% %new% %EmptyPL%())%,% %K %new% %EmptyPL%())))))%.% % %equals%(%new% %Person%(%"Joe"%,% %new% %LargerPL%(%new% %Person%(%"Jan"%,% %new% %LargerPL%(%new% %Person%(%"Joe"%,% %new% %EmptyPL%())%,% %new% %EmptyPL%()))%,% %$ %new% %LargerPL%(%new% %Person%(%"Mario"%,% %new% %LargerPL%(%new% %Person%(%"Joe"%,% %new% %EmptyPL%())%,% % %R %new% %LargerPL%(%n%e%w% %P%e%r%s%o%n%(%"Joe"%,% %n%e%w% %E%m%p%t%y%P%L%())%,% % %_ %new% %EmptyPL%())))%,% % %1 %new% %LargerPL%(%new% %Person%(% "Winston"%,% %new% %EmptyPL%())%,% % %> %new% %LargerPL%(%new% %Person%(%"Joe"%,% %new% %EmptyPL%())%,% %K %new% %EmptyPL%())))))) == true% %A %new% %Person%(%"Joe"%,% %new% %LargerPL%(%new% %Person%(%"Jan"%,% %new% %LargerPL%(%new% %Person%(%"Joe"%,% %new% %EmptyPL%())%,% %new% %EmptyPL%()))%,% % %% %new% %LargerPL%(%new% %Person%(%"Mario"%,% %new% %LargerPL%(%new% %Person%(%"Joe"%,% %new% %EmptyPL%())%,% % %A %A %A %A %3 %new% %LargerPL%(%n%e%w% %P%e%r%s%o%n%(%"Joe"%,% %n%e%w% %E%m%p%t%y%P%L%())%,% %new% %EmptyPL%())))%,% % %A %A %A %A %A %A % %new% %LargerPL%(%new% %Person%(% "Winston"%,% %new% %EmptyPL%())%,% % %? %new% %LargerPL%(%new% %Person%(%"Joe"%,% %new% %EmptyPL%())%,% %A %A %A %A %A %A %A % %new% %EmptyPL%())))))%.% % %equals%(%new% %Person%(%"Joe"%,% %new% %LargerPL%(%new% %Person%(%"Jan"%,% %new% %Larger%PL%(%new% %Person%(%"Joe"%,% %new% %EmptyPL%())%,% %new% %EmptyPL%()))%,% %$ %new% %LargerPL%(%new% %Person%(%"Mario"%,% %new% %LargerPL%(%new% %Person%(%"Joe"%,% %new% %EmptyPL%())%,% % %R %new% %LargerPL%(%n%e%w% %P%e%r%s%o%n%(%"Joe"%,% %n%ew% %E%m%p%t%y%P%L%())%,% % %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A % new EmptyPL%())))%,% %1 %new% %LargerPL%(%new% %Person%(%"Bob"%,% %new% %EmptyPL%())%,% % %> %new% %LargerPL%(%new% %Person%(%"Joe"%,% %new% %EmptyPL%())%,% %K %new% %EmptyPL%())))))) == false% % */  %M// (Question 4 CHALLENGE) Determine if another Person is equal to this Person%  "boolean 'equals"('Object 'o") "{ A A %F// ... this.name ... this.kids.PersonListMethod() ... o.ObjectMethod()% A A 'Person 'p "= "('Person")'o(; A A "return "this(.'name(.'equals"('p(.'name") "&& "this(.'kids(.'equals"('p(.'kids")(;  "}   %?// new Person("Fred", new EmptyPL()).sameNameAs("Joe") == false%  %(// new Person("Fred", new LargerPL(new P%Herson("Rudy", new EmptyPL()), new EmptyPL())).sameNameAs("Fred") == true%  %@// (Question 5) Determine whether this Person has the givenName %  "boolean ' sameNameAs"('String ' givenName") "{ A A %C// ... this.name ... this.kids.PersonListMethod() ... givenName ...% A A "return "this(.'name(.'equals"(' givenName")(;  "}   %/* %new% %Person%(%"Joe"%,% %new% %LargerPL%(%new% %Person%(%"Jan"%,% %new% %LargerPL%(%new% %Person%(%"Joe"%,% %new% %EmptyPL%())%,% %new% %EmptyPL%()))%,% %$ %new% %LargerPL%(%new% %Person%(%"Mario"%,% %new% %LargerPL%(%new% %Person%(%"Joe"%,% %new% %EmptyPL%())%,% %R %new% %LargerPL%(%n%e%w% %P%e%r%s%o%n%(%"Joe"%,% %n%e%w% %E%m%p%t%y%P%L%())%,% % %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A % new% %EmptyPL%())))%,% %1 %new% %LargerPL%(%new% %Person%(% "Winston"%,% %new% %EmptyPL%())%,% % %> %new% %LargerPL%(%new% %Person%(%"Joe"%,% %new% %EmptyPL%())%,% % %K %new% %EmptyPL%())))))%.% %A %A %A %A %A %A %A %A %A % %numDescendantsWithName%(%"Joe"%) == 4% %Z new Person("John", new LargerPL(new Person("Jill", new EmptyPL()), new EmptyPL())).% %1 numDescendantsWithName("Randy") == 0%A %A %A %A %A %A %A %A %A % % % */  %:// Determine the number of descendants with the given name%  "int 'numDescendantsWithName"('String ' givenName") "{ A %?// this.name ... this.kids.PersonListMethod() ... givenName ...% A "return "this(.'kids(.'numNamed"(' givenName")(;  "}   %/*% %^ new Person("John", new LargerPL(new Person("Jill", new EmptyPL()), new EmptyPL())). % % %) numDescendantsFrancis() == 0% %| new Person("Francis", new LargerPL(new Person("Bart", new LargerPL(new Person("Carl", new EmptyPL()), new EmptyPL())),% %y new LargerPL(new Person("Amber", new LargerPL(new Person("Bart", new EmptyPL()),% %A %A %A %A %A %* new EmptyPL())), % %A %A %A %A %A %A %) new LargerPL(new Person("Francis", % %A %A %A %A %A %A %@ new LargerPL(new Person("Francis",% %A %A %A %A %A %A %A %A %A %% new Emp%tyPL()),% %A %A %A %A %A %A %A %A %A %A %A %F new LargerPL(new Person("Francis", new EmptyPL()), new EmptyPL())))% %A %A %A %A %A %A %A %A % new EmptyPL())))).% %A % numDescendantsFrancis() == 3% % */  %X// (Question 6) Determine the number of descendants of this Person with the name Francis%  "int 'numDescendantsFrancis"() "{ A %5// ... this.name ... this.kids.PersonListMethod() ...% A "return 'numDescendantsWithName"(# "Francis"")(;  "}   %/*% %^ new Person("John", new LargerPL(new Person("Jill", new EmptyPL()), new EmptyPL())). % % % numWithName() == 0% %i new Person("Rudy", new LargerPL(new Person("Bart", new LargerPL(new Person("Carl", new EmptyPL()), % %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A %A % new %)EmptyPL())), % %A %s new LargerPL(new Person("Amber", new LargerPL(new Person("Bart", new EmptyPL()), % %A %] new EmptyPL())), % %A %A %A %A %A %A %# new LargerPL(new Person("Rudy", % %A %A %A %A %A %A %< new LargerPL(new Person("Rudy", % % %A %A %A %A %A %A %A %A %A %( new EmptyPL()), % %o new LargerPL(new Person("Rudy", new EmptyPL()),% %A %A %A %A %A %A %A %A %1 new EmptyPL()))), new EmptyPL())))).% %A %A %A %A %A %A %A %A %numWithName() == 3 %A % % % */  %n// (Question 7 CHALLENGE) Determine the number of descendants of this Person with the same name as this Person%  "int ' numWithName"() "{ A %5// ... this.name ... this.kids.PersonListMethod() ...% A "return 'numDescendantsWithName"(this(.'name")(;  "}  "}  ,& new EmptyPL().equals(new EmptyPL())true& ,&new EmptyPL() .numNamed( "Joe")0& & ,&Snew LargerPL(new Person( "Greg", new LargerPL(new Person( "Bob", new EmptyPL()), new EmptyPL())), new EmptyPL()).  equals(new LargerPL(new Person( "Greg", new LargerPL(new Person( "Bob", new EmptyPL()), new EmptyPL())),   new EmptyPL()))true& ,&Snew LargerPL(new Person( "Greg", new LargerPL(new Person( "Bob", new EmptyPL()), new EmptyPL())), new EmptyPL()).  equals(new LargerPL(new Person( "Greg", new LargerPL(new Person( "Joe", new EmptyPL()), new EmptyPL())),   new EmptyPL()))false ,&.new LargerPL(new Person( "Greg", new LargerPL(new Person( "Bob", new EmptyPL()), new EmptyPL())), new EmptyPL()).   numNamed( "Bob")1& ,&dnew LargerPL(new Person( "Greg", new LargerPL(new Person( "Bob", new EmptyPL()), 4 new LargerPL(new Person( "Greg", new EmptyPL()), new EmptyPL()))), A A  new LargerPL(new Person( "Greg", new LargerPL(new Person( "Greg", new EmptyPL()), new EmptyPL())), A A  new EmptyPL())) .numNamed( "Greg")4& , &<new Person( "Joe", new LargerPL(new Person( "Jan", new LargerPL(new Person( "Joe", new EmptyPL()), new EmptyPL())), $ new LargerPL(new Person( "Mario", new LargerPL(new Person( "Joe", new EmptyPL()),  R new LargerPL(new Person( "Joe", new EmptyPL()),  _ new EmptyPL()))),  1 new LargerPL(new Person(  "Winston", new EmptyPL()),  > new LargerPL(new Person( "Joe", new EmptyPL()), K new EmptyPL()))))).  equals(new Person( "Joe", new LargerPL(new Person( "Jan", new LargerPL(new Person( "Joe", new EmptyPL()), new EmptyPL())), $ new LargerPL(new Person( "Mario", new LargerPL(new Person( "Joe", new EmptyPL()),  R new LargerPL(new Person( "Joe", new EmptyPL()),  _ new EmptyPL()))),  1 new LargerPL(new Person(  "Winston", new EmptyPL()),  > new LargerPL(new Person( "Joe", new EmptyPL()), K new EmptyPL())))))) true , &Hnew Person( "Joe", new LargerPL(new Person( "Jan", new LargerPL(new Person( "Joe", new EmptyPL()), new EmptyPL())),  % new LargerPL(new Person( "Mario", new LargerPL(new Person( "Joe", new EmptyPL()),  A A A A 3 new LargerPL(new Person( "Joe", new EmptyPL()), new EmptyPL()))),  A A A A A A  new LargerPL(new Person(  "Winston", new EmptyPL()),  ? new LargerPL(new Person( "Joe", new EmptyPL()), A A A A A A A  new EmptyPL()))))).  equals(new Person( "Joe", new LargerPL(new Person( "Jan", new LargerPL(new Person( "Joe", new EmptyPL()), new EmptyPL())), $ new LargerPL(new Person( "Mario", new LargerPL(new Person( "Joe", new EmptyPL()),  R new LargerPL(new Person( "Joe", new EmptyPL()), new EmptyPL()))), 1 new LargerPL(new Person( "Bob", new EmptyPL()),  > new LargerPL(new Person( "Joe", new EmptyPL()), K new EmptyPL()))))))false  ,&new Person( "Fred", new EmptyPL()) .sameNameAs( "Joe")false& ,m&!new Person( "Fred", new LargerPL(new Person( "Rudy", new EmptyPL()), new EmptyPL())) .sameNameAs( "Fred")true& ,m&new Person( "Joe", new LargerPL(new Person( "Jan", new LargerPL(new Person( "Joe", new EmptyPL()), new EmptyPL())), $ new LargerPL(new Person( "Mario", new LargerPL(new Person( "Joe", new EmptyPL()), R new LargerPL(new Person( "Joe", new EmptyPL()), new EmptyPL()))), 1 new LargerPL(new Person(  "Winston", new EmptyPL()),  > new LargerPL(new Person( "Joe", new EmptyPL()),  K new EmptyPL()))))). A A A A A A A A A  numDescendantsWithName( "Joe")4& ,&#new Person( "John", new LargerPL(new Person( "Jill", new EmptyPL()), new EmptyPL())).  numDescendantsWithName( "Randy")0& & ,n&!new Person( "John", new LargerPL(new Person( "Jill", new EmptyPL()), new EmptyPL())).  numDescendantsFrancis()0& ,&new Person(  "Francis", new LargerPL(new Person( "Bart", new LargerPL(new Person( "Carl", new EmptyPL()), new EmptyPL())), ) new LargerPL(new Person( "Amber", new LargerPL(new Person( "Bart", new EmptyPL()), A A A A A  new EmptyPL())),  A A A A A A  new LargerPL(new Person(  "Francis",  A A A A A A  new LargerPL(new Person(  "Francis", A A A A A A A A A  new EmptyPL()), A A A A A A A A A A A  new LargerPL(new Person(  "Francis", new EmptyPL()), new EmptyPL()))), A A A A A A A A  new EmptyPL())))). A  numDescendantsFrancis()3  ,`&!new Person( "John", new LargerPL(new Person( "Jill", new EmptyPL()), new EmptyPL())).   numWithName()0& ,&new Person( "Rudy", new LargerPL(new Person( "Bart", new LargerPL(new Person( "Carl", new EmptyPL()), new EmptyPL())),  A  new LargerPL(new Person( "Amber", new LargerPL(new Person( "Bart", new EmptyPL()),  A L new EmptyPL())),  A A A A A A  new LargerPL(new Person( "Rudy",  A A A A A A  new LargerPL(new Person( "Rudy",   A A A A A A A A A  new EmptyPL()),  @ new LargerPL(new Person( "Rudy", new EmptyPL()), A A A A A A A A  new EmptyPL()))), new EmptyPL())))). A A A A A A A A  numWithName()3  %/* 8. CHALLENGE% % %A %class Someone extends Person {% %A %A %...% % %A %A %Q// To determine the number of children of this Person and of this Person's spouse% % %A %%int numDescendantsOfThisAndSpouse() {% %A %A %A %T// ... this.name ... this.spouse.PersonMethod() ... this.kids.PersonListMethod() ...% %A %A %A %7return numDescendents() + this.spouse.numDescendents();% %A % }% % }% % */