Results 1 to 2 of 2
  1. #1
    ruick78 is offline Member
    Join Date
    Sep 2016
    Posts
    2
    Rep Power
    0

    Question Java program Pyriamd

    I wanting make pyramid going though a loop making rectangles 12 base up to 1 or 1 down to 12 but i can't seem to make it happen. So some help me figure out how do it correctly i very much appreciate it.
    Java Code:
    import acm.graphics.*;
    import acm.program.*;
    public class Pyramid extends GraphicsProgram {
    	public void run() {
    		for (int i = 0; i <= 12; i++ ) {
    			for (int j = 0; j <= 12 - i; j++) {
    				System.out.print(" ");
    			}
    			for (int k = 0; k <= i; k++) {
    				GRect rect = new GRect(10,10,40,50);
    				add(rect);
    			}
    		}
    	}
    }

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Java program Pyriamd

    i can't seem to make it happen.
    Please post the program's output wrapped in code tags that shows what the program is doing now.
    Add some comments saying what is wrong with the output and show what the output should be.

    Note: Note many people know or use the acm package classes.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Replies: 19
    Last Post: 07-17-2015, 03:40 PM
  2. Replies: 6
    Last Post: 12-15-2013, 06:40 AM
  3. Replies: 4
    Last Post: 11-21-2012, 01:19 PM
  4. Replies: 0
    Last Post: 04-04-2008, 02:40 PM
  5. Replies: 0
    Last Post: 10-04-2007, 09:33 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
  •