Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface Shape {
- void resize(Bounds bounds);
- void scale(int percent);
- }
- class Rectangle implements Shape {
- private int width, height;
- public void resize(Bounds bounds) {
- width = bounds.getWidth();
- height = bounds.getHeight();
- }
- public void scale(int percent) {
- width *= percent;
- height *= percent;
- }
- }
- class Circle implements Shape {
- public void resize(Bounds bounds) {
- radius = bounds.getRadius();
- }
- public void scale(int percent) {
- radius *= percent;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement