Java Saved Program: ferrous-dog

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.*;
 
/* Name of the class has to be "Script" only */
class Script
{
	public static void main (String[] args)
	{
	    Rectangle rec = new Rectangle(2,3,4,"Brown"),
	    rec.extent();
	    rec.surface();
	    rec.print();
	}
}

class GeoCharacter
{
    private double ThinkLine;
    private String Color;
    
    public GeoCharacter(double thinkLine, String color)
    {
        this.ThinkLine = thinkLine;
        this.Color = color;
    }
    
    public abstract void surface()
    {
        
    }
    
    public abstract void extent()
    {
        
    }
}

class Rectangle extends GeoCharacter
{
    private double SideA;
    private double SideB;
    
    private Rectangle(double sideA, double sideB)
    {
        super(thinkLine, color);
        this.SideA = sideA;
        this.SideB = sideB;
    }
    
    public void setSideA(double sideA) 
    {
        this.SideA = sideA;
    }
     
    public void setSideB(double sideB) 
    {
        this.SideB = sideB;
    }
     
    public double getSideA()
    {
        return this.SideA;
    }
     
    public double getSideB()
    {
        return this.SideB;
    }
    
    private double surface()
    {
        return this.SideA * this.SideB;
    }
     
    private double extent()
    {
        return (2 * this.SideA) + (2 * this.SideB);
    }
     
    public void print()
    {
        System.out.println("Opseg pravokutnika je: " + this.extent());
        System.out.println("Povrsina pravokutnika je: " + this.surface() + "\n");
    }
}

class Circular extends GeoCharacter
{
    private double Radius;
    
    private Circular(double radius)
    {
        this.Radius = radius;
    }
    
    
}
Execute

Output

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

Inputs