LAB 4
/** 
 * AI: Francisco Lara-Dammer 
 * Lab 4
 * Goals: 
 * 1. To practice constructors;
 * 2. To practice how to create methods, and how to use them; 
 * 3. To give some feedback to the concept of fields in a class;
*/

class Point{
    double x, y;
    
    
    public Point(){
	this.x = 0;
	this.y = 0;
	
    }
    
    public Point(double u, double v){
	x = u;
	y = v;
	
    }
    
    double getX(){
	return x;
    }
    
    double getY(){
	return y;
    }
    
    double getDistanceToOrigen(){
	return Math.sqrt(this.getX()*this.getX() +this.getY()*this.getY());     
    }
    
    public static void main(String[] args){
	
	Point P = new Point(1.5, 2.4);
       
	System.out.println("The distance to the origen is " + P.getDistanceToOrigen());
	System.out.println("This is x in P" + P.getX());
	System.out.println("This is y in P" + P.getY());
	System.out.println("The distance to the origen is " + P.getDistanceToOrigen());
	
	Point Q = new Point();
	System.out.println("This is x in Q" + Q.getX());
	System.out.println("This is y in Q" + Q.getY());
	
    }   
}