Thats not a bad homework assignment. I might use it in my Java course this semester.
Could you post what you have for those two methods already? Then we can tell you if your going in the right direction.
For problem 1: You are going to need to put the shrink method inside of rectangle class. Then return a new rectangle where you add 1/2 the shrink size to the x and y of the rectangle and decrease the width by the shrink size.
For problem 2: You are going to have to enter a while loop where you loop so long as the rectangle is bigger than 2x2, addind the area of every rectangle along the way.
JeffHeaton
Junior Poster in Training
58 posts since Jul 2005
Reputation Points: 12
Solved Threads: 0
freesoft_2000
Practically a Master Poster
623 posts since Jun 2004
Reputation Points: 25
Solved Threads: 10