You are supposed to make two simple programs in this week.

1. Based on the rectangle class example in our text book, add "intersection method" to the rectangle class. The intersection method returns the intersection of two rectangles, that is the rectangle formed by two overlapping rectangles.

You call this method as follows:

Rectangle r3 = r1.intersection(r2);

r3 is the intersection rectangle formed by r1 and r2.

Write a program IntersectionPrinter that constructs two rectangle objects, prints them, and then prints the rectangle object that describes the intersection. Then the program should print the result of the intersection method when the rectangles do not overlap. Add a comment to your program that explains how you can tell whether the resulting rectangle is empty.

2. Write a program HollePrinter that switches the letters "e" and "o" in a string. Use the replace method repeatedly. You don't need to get inputs from console or GUI. Place the input in your code (For example String input = "Hello, World"). Demonstrate that the string "Hello, World!" turns into "Holle, Werld!".

내용은 요렇게,,,

역시 파일은 여기(였는데,,, due가 넘어가는바람에 검열당한,,,)

'대학생활 > JAVA' 카테고리의 다른 글

내맘대로 강좌 JAVA편 4  (0) 2009.03.25
내맘대로 강좌 JAVA편 3  (0) 2009.03.25
3주차 JAVA숙제가 나왔습니다^^  (2) 2009.03.23
내맘대로 강좌 JAVA편 2  (0) 2009.03.16
내맘대로 강좌 JAVA편 1  (3) 2009.03.16