aspose file tools*
The moose likes Beginning Java and the fly likes Hey Yall, does this look right? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Hey Yall, does this look right?" Watch "Hey Yall, does this look right?" New topic
Author

Hey Yall, does this look right?

Gabriel White
Ranch Hand

Joined: Mar 02, 2003
Posts: 233
Below, implement the interfaces of the classes in the class hierarchy used in an engineer-graphing system. An engineer should be able to draw points, lines, circles, ellipse, squares, rectangles, triangles, etc. You do not have to actually code the methods, just declare the headings. Make sure to use extends, abstract, protected, etc appropriately.
This is what I have: (remember I not supposed to implement code here)

[ April 11, 2003: Message edited by: Steve Wysocki ]
[ April 11, 2003: Message edited by: Steve Wysocki ]
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Do you want to show constructors or member variables to indicate the data needed for each shape - radius, angles, side lengths, etc ?
You may get sucked into the debate about whether a circle is a specialization (subclass) of elipse, or square is a rectangle. In geometry square is a special case of rectangle, but it has less information (e.g. one side length instead of two) and might break the substitution rule. Or not. Hey, I said it was a debate!
Oh, and think about singular names for classes instead of plural. An instance of the class will represent one thing, not many, so you can say things like "this object is a Circle"
[ April 11, 2003: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Gabriel White
Ranch Hand

Joined: Mar 02, 2003
Posts: 233
Ok, thanks Stan. Its just supposed to be a shell, as you can see by the question. No constuctor required. I could code this all out but our instructor doesn't want us to do that.
But I will change the plural class names. (I hate that crap)
Peace out
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
I note that you've got a lot of semicolons in places they shouldn't be. You ought to be able to make this class compile, even though methods are just empty shells. Except that any non-void method will require some sort of return statement; I'd usually just stick in a "return 0;" or "return null;" as a placeholder to make the compiler happy, until I replace it with a "real" implementation.


"I'm not back." - Bill Harding, Twister
Gabriel White
Ranch Hand

Joined: Mar 02, 2003
Posts: 233
uhh, I don't see them sheriff. Anyway, this is just supposed to be a (Non-Working) shell of a program that does what the question states. Thats all. Ok I see that I missed a few brackets toward the bottom. Oops.
But thanks for the reply, I keep an eye on thoes semi-colons
peace out
[ April 11, 2003: Message edited by: Steve Wysocki ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
E.g.

should be
or even
to allow a compiler to check your work easily. I realize this is just an excercise, but it's also something you may well find yourself doing later as part of a real project. You decide to implement an interface in a class, so the first thing you do is put in empty shells like this to remind yourself what methods you need, even though you haven't written them yet. Then you gradually fill them in with real implementations, and it's eventually going to be a working, compilable class file. You might as well get rid of those semicolons now; otherwise they're just going to cause trouble later.
[ April 11, 2003: Message edited by: Jim Yingst ]
 
wood burning stoves
 
subject: Hey Yall, does this look right?