import java.io.*; class Punct{ private int x; private int y; private char cadranul; public void init(int xx, int yy) { x = xx; y = yy; } public void move(int dx, int dy) { x += dx; y += dy; } public int getX( ) { return x; } public int getY( ) { return y; } public char cadran(int x, int y) { if (x>=0) { if (y>=0) { cadranul= '1'; } else { cadranul='4'; } } else { if (y>0) { cadranul= '2'; } else { cadranul= '3'; } } return cadranul; } } class ClientPunct { public static void main(String[ ] arg) { Punct p1 = new Punct( ); //creare instante a clasei Punct Punct p2 = new Punct( ); p1.init (1,1); p2.init (-3,-4); //apelare metode init ale instantelor System.out.println("(x1,y1) = ("+p1.getX( )+","+p1.getY( )+") in cadranul "+p1.cadran(p1.getX( ),p1.getY( ))); System.out.println("(x2,y2) = ("+p2.getX( )+","+p2.getY( )+") in cadranul "+p2.cadran(p2.getX(),p2.getY())); p1.move(-5,5); p2.move(6,-7); //apelare metode move ale instantelor System.out.println("(x1,y1) = ("+p1.getX( )+","+p1.getY( )+") in cadranul "+p1.cadran(p1.getX( ),p1.getY( ))); //afisare coordonate curente ale primului punct System.out.println("(x2,y2) = ("+p2.getX( )+","+p2.getY( )+") in cadranul "+p2.cadran(p2.getX(),p2.getY())); //afisare coordonate curente ale celui de-al 2-lea punct } }