Java Homework ideas;

Discussion in 'Programmer's Corner' started by Darknight7, Nov 3, 2012.

  1. Darknight7

    Thread Starter New Member

    May 21, 2012
    20
    0
    (Geometry: n-sided 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:
    • An int data field named n that defines the number of sides in the
    polygon with default value 3.
    • A double data field named side that stores the length of the side with
    default value 1.
    • A double data field named x that defines the x-coordinate of the center
    of the polygon with default value 0.
    • A double data field named y that defines the y-coordinate of the center
    of the polygon with default value 0.
    • A no-arg constructor that creates a regular polygon with default
    values.
    • A constructor that creates a regular polygon with the specified number
    of sides and the length of side, and centered at (0, 0).
    • A constructor that creates a regular polygon with the specified number
    of sides, the length of side, and x-and y-coordinates.
    • The method getPerimter() that returns the perimeter of the polygon.
    • The method getArea() that returns the area of the polygon. ThThe formula
    for computing the area of a regular polygon is

    Area=(n*s^2)/4*tan(pi/n)

    How can I find a solution with uml
     
  2. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,804
    What does UML have to do with it?

    Is the assignment to implement a class, or to document a class as part of a much larger project?
     
  3. sileli

    New Member

    Nov 4, 2012
    1
    0
    i am also waiting the answer of this question
     
  4. jacques

    New Member

    Nov 26, 2012
    5
    0
    It's too difficult to find out the answer of many question arise in a sequence. Let's see how many answer of these questions.
     
Loading...