CS100, Spring 2000, Exercise 5: Don't Box Me In! Due at the beginning of lecture on Tuesday, March 7 Name: William the Conqueror ID: 001066 (a) Fill in the blanks and boxes below to match the comments. class Parthon { String name; ________________________________________ ; // name of the Parthon Parthon parent; ________________________________________ ; // parent of the Parthon } public class Exercise5 { public static void main(String[] args) { Parthon ur; +-------------------------------------+ | | | ur = new Parthon(); | // Ani | ur.name = "Ur"; | // | | ur.parent = new Parthon(); | // | | ur.parent.name = "Naj"; | // Naj | ur.parent.parent = new Parthon(); | // | | ur.parent.parent.name = "Ani"; | // | | | // Ur +-------------------------------------+ // ******* draw the Box diagram for this point in the program ******* } // method main } // class Parthon (b) Draw the requested box diagram. class Exercise5 class Parthon +---------------+ +----------------------------------------------------------+ | main(args) | | | | +-----------+ | | | | | +--+ | | | | | | args | | | | | +--------------+ | | | +--+ | | | | | | | | | | | +-------------+ +-------------+ | +-----------+-+ | | | +--+ | | | | | | | | | | | | | | ur | *+-+-+--+->| +--+ | | +--+ | | | +--+| | | | | +--+ | | | | name | *+-+-+ | name | *+-+-+ | | name | *++ | | | | | | | | +--+ | | | +--+ | | | | +--+ | | | +-----------+ | | | | | | | | | | | | | | | | +--+ | | | +--+ | | | | +----+| | +---------------+ | | parent | *+-+-+->| parent | *+-+-+-+->| parent|null|| | | | +--+ | | | +--+ | | | | +----+| | class String | | | | | | | | | | | +---------------+ | +-------------+ | +-------------+ | | +-------------+ | | | | | | | | | "Ur" <-------+--+------------------+ | | | | | | | | | | "Naj"<-------+--+-------------------------------------+ | | | | | | | | "Ani"<-------+--+---------------------------------------+ | | | | | +---------------+ +----------------------------------------------------------+