Completed

Homework Help

This problem is driving me crazy...can you help?? Build a class heirarchy based on the abstract class TwoDShape, defined below: TwoDShape abstract definition public abstract class TwoDShape{ protected double area, perimeter; protected String name; public TwoDShape(String n){ area=0; perimeter=0; name=n; }// constructor public abstract double computeArea(); public abstract double computePerimeter(); public double getArea(){retrun area;}// getarea public double getPerimeter(){return perimeter;}// get perimeter public String toString(){ return name; }//toString }//twodshape Design a concrete class Circle, which will extend from the abstract class. Also, design a class MyRectangle extended from TwoDShape, as well as a class called Square extended from My Rectangle. Design the classes to make maximum use of inherited methods and members and not have to re-invent everything at every class level. Circle class: This class will have a constructor that will accept a double. That double will be the radius of the cirlce. It will also have a private double data member called radius. It must be designed so that the radius can never be set to less than 1. If any attempt is made to set the radius <1, the radius should be set to 1. Use get and set methods for the radius, as well as a toString method that returns a string announcing that it is a circle and giving it's area and perimeter. (use Math class PI). MyRectangle class: Should have 2 protected double data members, length and width. It will have a constructor that requires two doubles (length and width). Be sure the length and width cannot be less than 1. As in the circle, set it to 1, if less than 1. Use set and get methods for length and width. It's toString method will announce it's a rectangle and give the area and perimeter. Square: Will have a constructor that accepts a single double, the length of a side. Again, the side should never be smaller than 1. The square will have a getSide and setSide method. NOTE: Be sure the get and set methods are inherited from My Rectangle. The test program for the project will be an application, and need not be interactive. It should instantiate one each of the concrete classes and test the methods. Use an array of TwoDShapes that wil be used to reference the instantiated objects and further test them, insuring that polymorphism works. Use a TextArea on a scroll pane for your output.

## Deliverables

Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. Complete copyrights to all work purchased. The documentation for this project will consist of an html file created by javaDoc on the Square class. Each method defined in that class must have javadoc comments for display. The docs will use parameter and author tags as appropriate.

## Platform

Windows

## Deadline information

Must be complete and delivered on 07/17/2002 by 4:00 PM EST

Skills: Engineering, Java, MySQL, PHP, Software Architecture, Software Testing

See more: two string problem, string source code java, java string class documentation, java 1.4 documentation, invent help, get length of string in c, est java, 42 design square, c++ homework help, math homework, java project help, java complete reference, invent, inherited, homework math, homework help\, by my definition, area of a circle, help build, textarea complete

About the Employer:
( 6 reviews ) United States

Project ID: #2860959

Awarded to:

andretvw

See private message.

$10 USD in 14 days
(26 Reviews)
4.4

2 freelancers are bidding on average $18 for this job

rozarus

See private message.

$25.5 USD in 14 days
(53 Reviews)
3.3