Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By JosAH

Thread: patterns

  1. #1
    chameera is offline Member
    Join Date
    Apr 2013
    Posts
    2
    Rep Power
    0

    Default patterns

    hi, i'm new to the forum & java language too
    can u help me with creating these types of patterns in command prompt??
    1)
    0 1 1 1 0
    1 0 1 0 1
    1 1 0 1 1
    1 0 1 0 1
    0 1 1 1 0

    2)
    1 1 0 1 1
    1 1 0 1 1
    0 0 0 0 0
    1 1 0 1 1
    1 1 0 1 1

    pls don't try to assign values directly...

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,732
    Blog Entries
    7
    Rep Power
    21

    Default Re: patterns

    Imagine two axes X and Y; the first pattern can be described as:

    Java Code:
    (Math.abs(X) == Math.abs(Y))?0:1;
    and the second pattern can be described as:

    Java Code:
    (X == 0 || Y == 0)?0:1;
    now all you have to do is iterate Y and X over some values and print out the result of one of the above expressions.

    kind regards,

    Jos
    jim829 likes this.
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    chameera is offline Member
    Join Date
    Apr 2013
    Posts
    2
    Rep Power
    0

Similar Threads

  1. Patterns
    By whosadork in forum New To Java
    Replies: 8
    Last Post: 10-23-2008, 12:37 PM
  2. Bean Patterns
    By Sysem in forum New To Java
    Replies: 0
    Last Post: 05-26-2008, 08:33 PM
  3. Design patterns
    By Freddie in forum New To Java
    Replies: 2
    Last Post: 05-12-2007, 07:21 AM

Posting Permissions

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