Java Saved Program: beautiful-home

facebook share

Here's the online compiler accompanied with IDE at your service. This is a saved code by one of our users. Try it out or save your own from the IDE page and don't forget to leave a feedback. You can find that at the bottom of the page.


import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Scanner;

class Script
{
	public static void main (String[] args)
	{
        Tocka tocka1 = new Tocka();
        Tocka tocka2 = new Tocka (2, 5);
        
        Pravac z = new Pravac(tocka1, tocka2);
        System.out.println("Pravac z je odreden tockom1(" + z.A.getX() + "," + z.A.getY() + ") i tockom2(" + z.B.getX() + "," + z.B.getY() + ")");
	}
}

class Tocka
{
    double X;
    double Y;
    
    public Tocka()
    {
        this.X = 0;
        this.Y = 0;
    }
    
    public Tocka(double x, double y)
    {
        this.X = x;
        this.Y = y;
    }
    
    public double getX()
    {
        return this.X;
    }
    
    public void setX(double x)
    {
        this.X = x;
    }
    
    public double getY()
    {
        return this.Y;
    }
    
    public void setY(double y)
    {
        this.Y = y;
    }
}

class Pravac
{
    Tocka A;
    Tocka B;
    
    public Pravac(Tocka a, Tocka b)
    {
        this.A = a;
        this.B = b;
    }
    
    public Tocka getA()
    {
        return this.A;
    }
    
    public void setA(Tocka a)
    {
        this.A = a;
    }
    
    public Tocka getB()
    {
        return this.B;
    }
    
    public void setB(Tocka b)
    {
        this.B = b;
    }
}
Execute

Output

Press the execute button or CTRL + enter to run code.

Inputs