Problem #1
- Given method parameter of type Circle named circ
- Send the message getBoundary to circ
- Assign the return value to a var named boundary
- Get the top of the boundary and assign the value to a var named result of type int
- Return result
Problem #2
- Given method parameter named ellipse of type Ellipse
- Given additional method parameter named rec of type Rectangle
- Send the message getLongDimension to the var ellipse.
- Assign the return value to a var named dim
- Send the message setLongDimension to the Rectangle object using a var that you have available
- Return the Rectangle variable
Problem #3
- Given two method parameters both of type Point: p1 and p2
- Send the message plus to the first point with the other point as a method parameter, and assign the result to a var named p3
- Return p3
Problem #4
- We are given method parameters space of type OuterSpace and g of type Graphics
- Send the message drawOn to the OuterSpace object
- Return var space
Problem #5
- Given two method parameters: a Point named p, and a Frame named frame
- Send a message to determine if frame contains p
- Assign the result to a var named result
- Return result
Problem #6
- Given two method parameters: an Ellipse named ellipse, and a Circle named circ
- Send the message getAnchor to ellipse and assign the result to a var p1
- Send the message getAnchor to circ and assign the result to a var p2
- Sum p1 and p2 using the message plus and assign the result to a var sum
- Return sum
Problem #7
- Given a method parameter named fw of type ForwardIndicator
- Given two more method parameters x and y of type int
- Send the message conformX to fw with the correct parameter and assign the result to a var x2
- Send the message conformY to fw with the correct parameter and assign the result to a var y2
- Construct a var p of type Point
- Send the appropriate messages to the var p so that you set the point's x and y with the x2 and y2 vars
- Return p
Problem #8
- Construct a var named p of type Point
- Set the x value of p to 808 by sending the appropriate message to p
- Set the y value of p to 707 by sending the appropriate message to p
- Return p
Problem #9
- Given method parameters p1 and p2 of type Point
- Given another method method parameter named k of type int
- Multiply p1 and p2 and assign the result to a var product
- Send the message multiply to product using the method parameter that is an integer and assign result to product
- Return product
Problem #10
- Given three method parameters: a var named circ (a Circle), a var named g (a Graphics) and a var named color, (a Color)
- Send a message to circ passing the other two parameters g and color
- No return value
Problem #11
- Given a var named ellipse of type Ellipse
- Determine the area of the boundary of ellipse and put the result into a var named area (assume area = width * height)
- Return area
Problem #12
- Given a var named ellipse of type Ellipse
- Construct a Circle named circ
- Set the anchor of circ with the message parameter obtained by sending a message (your choice) to ellipse
- Then set the longDimension of circ to a value of your choice
Problem #13
- Given a method parameters circ of type Circle and elli of type Ellipse
- Send any message to circ and assign the return value to elli
- Return elli
Problem #14
- Given method parameters frame of type Frame and lastName of type String
- Send the message contains to frame sending one parameter (the var lastName) and assign the result to var doesContain
- return doesContain
Problem #15
- Given method parameters circ of type Circle and favColor of type Color
- Send the message drawOn to circ passing the parameter favColor
- Return circ