Results 1 to 7 of 7
  1. #1
    ccie007 is offline Senior Member
    Join Date
    May 2010
    Posts
    112
    Rep Power
    0

    Default 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.

  2. #2
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    5

    Default


    That?

    How familiar are you with GraphicsProgram? Do you know how to write a subclass? Do you know how to draw lines & circles?

  3. #3
    ccie007 is offline Senior Member
    Join Date
    May 2010
    Posts
    112
    Rep Power
    0

    Default

    I am familiar with the GraphicsProram okay and I can creat the peace sign too but confuse with this part

    Implement a method drawPeaceSymbol with the header line

    void drawPeaceSymbol(double x, double y, double r)
    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 saying
    Write
    a subclass of GraphicsProgram to test your method.
    or is it saying to write the client program to run the class(implementor program)?

  4. #4
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    5

    Default

    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.

  5. #5
    ccie007 is offline Senior Member
    Join Date
    May 2010
    Posts
    112
    Rep Power
    0

    Default

    Yes mate , I belive you are correct.In the question above where should be this method

    void drawPeaceSymbol(double x, double y, double r)
    in implementor or in main class.I believe in implementor, right?

    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 ?
    that draws a peace symbol centered at the point (x, y
    I believe is the width and height of GCompound ,is that right?

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,236
    Rep Power
    19

    Default

    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

  7. #7
    ccie007 is offline Senior Member
    Join Date
    May 2010
    Posts
    112
    Rep Power
    0

Similar Threads

  1. How to use graphics
    By Mattedatten in forum New To Java
    Replies: 3
    Last Post: 03-18-2010, 02:10 PM
  2. Help me with graphics
    By 7oclock in forum New To Java
    Replies: 12
    Last Post: 04-04-2009, 11:20 PM
  3. Help with 2d graphics please
    By xbox_nutter in forum New To Java
    Replies: 0
    Last Post: 04-02-2009, 11:48 AM
  4. graphics
    By Joe2003 in forum Advanced Java
    Replies: 4
    Last Post: 01-18-2008, 07:44 PM
  5. Graphics
    By feniger in forum New To Java
    Replies: 1
    Last Post: 12-29-2007, 04:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •