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가 넘어가는바람에 검열당한,,,)