Results 1 to 7 of 7
Thread: Graphics program
- 10-27-2010, 06:04 PM #1
Senior Member
- Join Date
- May 2010
- Posts
- 112
- Rep Power
- 0
Graphics program
Hi there,
I am trying to solve this question from the book "Art and science of Java".But I am not understanding what the question is asking me to do.I would be grateful if somebody could explain to me please.Here is the question,Diagram of peace symbol is missing but I believe we all know the symbol of peace which Green Peace uses.In the 1960s, this symbol
became universally identified as the peace symbol, and it still shows up from time to
time as a motif for T-shirts or jewelry. The peace symbol took its form from the
letters N and D—the initial letters in nuclear disarmament—as expressed in the
international semaphore code:
The peace symbol is formed by superimposing the lines in these two diagrams
(without the flags) and enclosing them in a circle.
Implement a method drawPeaceSymbol with the header line
void drawPeaceSymbol(double x, double y, double r)
that draws a peace symbol centered at the point (x, y) with a circle of radius r. Write
a subclass of GraphicsProgram to test your method.
- 10-27-2010, 06:31 PM #2

That?
How familiar are you with GraphicsProgram? Do you know how to write a subclass? Do you know how to draw lines & circles?
- 10-27-2010, 07:21 PM #3
Senior Member
- Join Date
- May 2010
- Posts
- 112
- Rep Power
- 0
I am familiar with the GraphicsProram okay and I can creat the peace sign too but confuse with this part
I know there are 2 programs for this exercise.1 is client program and another one is implementor program(class).Is this class what the question is referring to by sayingImplement a method drawPeaceSymbol with the header line
void drawPeaceSymbol(double x, double y, double r)or is it saying to write the client program to run the class(implementor program)?Write
a subclass of GraphicsProgram to test your method.
- 10-27-2010, 07:39 PM #4
As far as I can tell without actually reading the whole book (for context purposes), the implementor should be the GraphicsProgram and the main class should just call that. That's the best I can tell though.
- 10-27-2010, 07:53 PM #5
Senior Member
- Join Date
- May 2010
- Posts
- 112
- Rep Power
- 0
Yes mate , I belive you are correct.In the question above where should be this method
in implementor or in main class.I believe in implementor, right?
void drawPeaceSymbol(double x, double y, double r)
I believe this exercise is asking me to create a peace symbol which gets adjust according to the constructor values put by main client program.You know I mean,if a user put 100 as a radius of a circle then radius will 100 and if user puts radius as 150 the peace symbol will be bigger .... and so on.That's what that
"double r" above there is for.What are those "double x,double y" there for ,do
u know ?I believe is the width and height of GCompound ,is that right?that draws a peace symbol centered at the point (x, y
- 10-27-2010, 08:06 PM #6
By convention, x and y are usually the coordinates of the upper left corner of a component or the bounding rectangle of a graphic, measured in pixels from the top left corner of the screen.
However, your assignment as quoted by you explicitly specifies them as the coordinates of the center of the peace symbol. It can't get any clearer than that.
db
- 10-27-2010, 08:08 PM #7
Senior Member
- Join Date
- May 2010
- Posts
- 112
- Rep Power
- 0
Similar Threads
-
How to use graphics
By Mattedatten in forum New To JavaReplies: 3Last Post: 03-18-2010, 02:10 PM -
Help me with graphics
By 7oclock in forum New To JavaReplies: 12Last Post: 04-04-2009, 11:20 PM -
Help with 2d graphics please
By xbox_nutter in forum New To JavaReplies: 0Last Post: 04-02-2009, 11:48 AM -
graphics
By Joe2003 in forum Advanced JavaReplies: 4Last Post: 01-18-2008, 07:44 PM -
Graphics
By feniger in forum New To JavaReplies: 1Last Post: 12-29-2007, 04:22 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks