adapting java api classes
a) Implement a subclass Square that extends the Rectangle class. In the constructor accept the x and y positions of the centre and the side length of the square. (Use the setLocation and setSize methods of the Rectangle class from the Java API).
b) Supply a method getArea that computes and returns the area of the square.
c) Write a test harness that creates a new Square object and then prints out its details using the toString method that has been inherited from the Retangle class.
d) Also print out the area of the Square.
The specifications look good, what do you want us to do for you now? We would be glad to see your progress on this assignment and help you if you have an issues.
DevSquare - Online Application Development
Last Post: 06-14-2006, 03:16 PM
Last Post: 05-13-2005, 06:46 AM
By Mr. Spock in forum VB Classic
Last Post: 08-24-2000, 12:34 PM
By Sreedhar V in forum ASP.NET
Last Post: 05-16-2000, 06:42 PM
By H. Wilson in forum Java
Last Post: 04-14-2000, 11:25 AM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL