UML class diagram

//program in java
import java.lang.*;
//--------------------------
class RegularPolygon{
private int n;
private double side;
private double x;
private double y;
//default constructor
public RegularPolygon(){
n=3;
side=1;
x=y=0;
}
//parameterized constructor
public RegularPolygon(int m,double len){
n=m;
side=len;
x=y=0;
}
//parameterized constructor
public RegularPolygon(int m,double len,double a,double
b){
n=m;
side=len;
x=a;
y=b;
}
public void setNumberOfSide(int m){
n=m;
}
public void setSideLength(double len){
side=len;
}
public void setXcoordinate(double a){
x=a;
}
public void setYcoordinate(double b){
y=b;
}
public int getNumberOfSide(){
return n;
}
public double getSideLength(){
return side;
}
public double getXcoordinate(){
return x;
}
public double getYcoordinate(){
return y;
}
//finds perimeter
public double getPerimeter(){
return n*side;
}
//find area
public double getArea(){
double
area=(n*side*side)/(Math.tan(Math.PI/n)*4);
return area;
}
}
//----------main class-------------
public class RegularPolygonMain{
public static void main(String args[]){
RegularPolygon p1=new
RegularPolygon();
RegularPolygon p2=new
RegularPolygon(6,4);
RegularPolygon p3=new
RegularPolygon(10,4,5.6,7.8);
System.out.println("perimeter=
"+p1.getPerimeter());
System.out.println("Area=
"+p1.getArea());
System.out.println("perimeter=
"+p2.getPerimeter());
System.out.println("Area=
"+p2.getArea());
System.out.println("perimeter=
"+p3.getPerimeter());
System.out.println("Area=
"+p3.getArea());
}
}
//------------------------
ouput:

Problem 2 9.9 Geometry: n-sided regular polygon pg. 362 (25 points) Follow instructions as provided on...
//include comments
Opts (Regular polygon) An n-sided regular polygon has n sides of the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular). Design a class named RegularPolygon that contains: Aprivate int data field named n that defines the number of sides in the polygon with default value 3. A private double data field named side that stores the length of the side with default value 1. A private double data field...
(Geometry: n-sided regular polygon) An n-sided regular polygon’s sides all have the same length and all of its angles have the same degree (i.e., the polygon is both equilateral and equiangular). Design a class named RegularPolygon that contains: ■ A private int data field named n that defines the number of sides in the polygon. ■ A private float data field named side that stores the length of the side. ■ A private float data field named x that defines...
N-Sided Polygon An n-sided polygon is a planed figure whose sides have the same length and whose angles have the same degree. Write a class called NSidedPolygon that contains the following components: Private members to store the name of a polygon, the number of sides, and the length of each side. (You are expected to select the appropriate data types for each member.) A constructor that accepts the number of sides and the length of each side. A private method...
A regular polygon is an n-sided polygon in which all sides are of the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular). The formula for computing the area of a regular polygon isArea =Here, s is the length of a side. Write a program that prompts the user to enter the number of sides and their length of a regular polygon and displays its area. Here is a sample run:
Write a simple class representing a Polygon up to 6 sides: the Polygon class has 5 fields: Regular, sides, sideLength, angle, apothem Polygon: Regular: boolean sides: int sideLength: double angle : double apothem : double Provide a no-arg constructor for this class initializes the object and sets the instance variables to: Regular: true sides: 3 sideLength: 1 angle : 60 apothem : SquareRoot(3)/2 Provide the following methods: Set number of sides set the length of the sides set the angle...
Do exercise 9.1 in the book (page 362, or page 384 of the Comprehensive Version of the book) Also add a method named getDiagonal which computes and returns the diagonal of the rectangle. For example the distance from the top left corner to the bottom right corner. Or equivalently the distance from the top right corner to the bottom left corner. Call this method and display it's output in your test program. for the two Rectangle objects. Here is exercise...
Please include comments in the program .The program must be able to be compiled.Design a class named Triangle that extends GeometricObject. This class contains:* Three double data fields named side1, side2, and side3 with default values 1.0 to denote the three sides of a triangle.* A no-arg constructor that creates a default triangle.* A constructor that creates a triangle with the specified side1, side2, and side3.* The accessor methods for all three data fields.* A method named getArea() that returns...
This is for java programming Please Show plenty of comments so I can follow the steps Design a class named Account that contains: • A private int data field named id for the account (default 0) • A private double data field named balance for the account (default 0) • A private double data field named annualInterestRate that stores the current interest rate (default 0). Assume all accounts have the same interest rate. • A private Date data field named...
java language
Problem 3: Shape (10 points) (Software Design) Create an abstract class that represents a Shape and contains abstract method: area and perimeter. Create concrete classes: Circle, Rectangle, Triangle which extend the Shape class and implements the abstract methods. A circle has a radius, a rectangle has width and height, and a triangle has three sides. Software Architecture: The Shape class is the abstract super class and must be instantiated by one of its concrete subclasses: Circle, Rectangle, or...
Design a general class GeometricObject can be used to model all geometric objects. This class contains the properties color and filled and their appropriate get and set methods. Assume that this class also contains toString() methods. The toString() method returns a string representation of the object. Define the Triangle, Circle, and Rectangle classes that extend the GeometricObject class. The Triangle class inherits all accessible data fields and methods from the GeometricObject class.In addition, it has three double data fields named...