




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































class Point {
int xpos;int ypos;Point(int x, int y) {
xpos = x;ypos = y; } int getX() {
return xpos; } int getY() {
return ypos; } void setX(int x) {
xpos = x; } void setY(int y) {
ypos = y; } }
class Rectangle {Point lowerleftpt;Point upperrightpt;Rectangle(Point lowerleft, Point upperright) {
lowerleftpt = lowerleft;upperrightpt = upperright; } int length() {
return upperrightpt.getX() - lowerleftpt.getX(); } int height() {
return upperrightpt.getY() - lowerleftpt.getY(); } int area() {
return length() * height(); } }
void classdef() :{}{
(classElem())* } void
classElem() :
{} {
(