import java.awt.Graphics;
import java.awt.Color;public class MethodHeaderExample {
public int problem1(Circle circ) {
Frame boundary;
boundary = circ.getBoundary();
int result = boundary.getTop();
return result;
}
public Rectangle problem2(Ellipse ellipse, Rectangle rec) {
int dim;
dim = ellipse.getLongDimension();
rec.setLongDimension(dim);
return rec;
}
public Point problem3(Point p1, Point p2) {
Point p3;
p3 = p1.plus(p2);
return p3;
}
public OuterSpace problem4(OuterSpace space, Graphics g) {
space.drawOn(g);
return space;
}
public boolean problem5(Point p, Frame frame) {
boolean result;
result = frame.contains(p);
return result;
}
public Point problem6(Ellipse ellipse, Circle circ) {
Point p1, p2;
p1 = ellipse.getAnchor();
p2 = circ.getAnchor();
Point sum;
sum = p1.plus(p2);
return sum;
}
public Point problem7(ForwardIndicator fw, int x, int y) {
int x2, y2;
x2 = fw.conformX(x);
y2 = fw.conformY(y);
Point p;
p = new Point();
p.setX(x2);
p.setY(y2);
return p;
}
public Point problem8() {
Point p;
p = new Point();
p.setX(808);
p.setY(707);
return p;
}
public Point problem9(Point a, Point b, int k) {
Point product;
product = a.multiply(b);
product = product.multiply(k);
return product;
}
public Circle problem10(Circle circ, Graphics g, Color color) {
circ.drawOn(g, color);
return circ;
}
public int problem11(Ellipse ellipse) {
Frame f = ellipse.getBoundary();
int area = f.getWidth() * f.getHeight();
return area;
}
public Circle problem12(Ellipse ellipse) {
Circle circ;
circ = new Circle();
circ.setAnchor(ellipse.getAnchor());
circ.setLongDimension(1093);
return circ;
}
public String problem13(Circle circ, Ellipse elli) {
return "No Solution";
}
public String problem14(Frame frame, String lastName) {
return "No Solution";
}
public String problem15(Circle circ, Color favColor) {
return "No Solution";
}
}
Introduction To Objects With Java
(Chapter 405 - Method Headers)