Class Shapes Java Exercise - Java Programming Course

 Exercise

Class Shapes

 Objetive

Create a project and the corresponding classes (using several files) for this classes diagram.

 Example Code

package shapes;
public class Circle extends Shape
{
	protected double radius;
}

package shapes;
public class Location
{
	private double x, y;
}

package shapes;
public class Rectangle extends Shape
{
	protected double side1, side2;
}

package shapes;
public class Shape
{
	protected Location c;

	public final String toString()
	{
		return "";
	}

	public final double Area()
	{
		return 0.000;
	}

	public final double Perimeter()
	{
		return 0.000;
	}
}

package shapes;
public class Main
{
	static void main(String[] args)
	{

	}
}



Juan A. Ripoll - Programming Tutorials and Courses © 2024 All rights reserved.  Legal Conditions.