Results 1 to 1 of 1
  1. #1
    djtoxicdance is offline Member
    Join Date
    May 2011
    Posts
    8
    Rep Power
    0

    Exclamation For loop graphics

    Im doing a project and i got only a 1/5 of the way there. i want to use (*) to create 5 basic shapes using 4 loops and arrays. The first shape the diamond i have completed. what i need is a rectangle, a square, a bulls eye (like a shooting target 4 circles) and a hypnoses spiral. <deleted by moderator>. just note im new to the forums. the diamond code i have looks like this
    Java Code:
    class Diamond {
      public static void main(String[] args) {
        for (int i = 1; i < 10; i += 2) {
          for (int j = 0; j < 9 - i / 2; j++)
            System.out.print(" ");
    
          for (int j = 0; j < i; j++)
            System.out.print("*");
    
          System.out.print("\n");
        }
    
        for (int i = 7; i > 0; i -= 2) {
          for (int j = 0; j < 9 - i / 2; j++)
            System.out.print(" ");
    
          for (int j = 0; j < i; j++)
            System.out.print("*");
    
          System.out.print("\n");
        }
      }
    }
    /*
             *
            ***
           *****
          *******
         *********
          *******
           *****
            ***
             *
    */
    Last edited by Fubarable; 05-09-2011 at 05:37 AM. Reason: inappropriate request deleted

Similar Threads

  1. JTextField loop 2x for-loop WEIRD!
    By Streetproject in forum AWT / Swing
    Replies: 2
    Last Post: 02-16-2011, 05:46 PM
  2. Replies: 7
    Last Post: 01-17-2011, 07:02 AM
  3. Drawing a graphics onto another Graphics ?
    By Ziden in forum Java Applets
    Replies: 0
    Last Post: 01-08-2011, 07:30 PM
  4. Replies: 13
    Last Post: 07-06-2008, 09:11 AM
  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
  •