Show Bid Request
Homework Help
Bid Request Id: 21933
|
|
|
Description:
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
Special Conditions / Other:
Must be complete and delivered on 07/17/2002 by 4:00 PM EST
Remember that contacting the other party outside of the site (by email, phone, etc.) on all business projects < $500 (before the buyer's money is escrowed) is a violation of both the software buyer and seller agreements.
We monitor all site activity for such violations and can instantly expel transgressers on the spot, so we thank you in advance for your cooperation.
If you notice a violation please help out the site and report it. Thanks for your help.
|
|
Bidding/Comments:
|
All monetary amounts on the site are in United States dollars.
Rent a Coder is a closed auction, so coders can only see their own bids and comments. Buyers can view every posting made on their bid requests. |
See all rejected bids (and all comments)
Name |
Bid Amount |
Date |
Coder Rating |
|
|
|
This bid was accepted by the buyer!
|
$13 (USD)
|
Jul 17, 2002 10:12:34 AM EDT
|
9.66
(Excellent)
|
|
|
I can do this in a couple of hours. I guarantee very clear source code with appropriate comments. Just choose my bid and you will have the code developed in time.
Regards, Andrei |
|
|
|
|
|