Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2010
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Using nested loops and constant values to draw figure

    Write a Java program in a class named Window that produces the preceding figure as output. Use nested for loops to print the repeated parts of the figure. Once you get it to work, add one class constant to your program so that the size of the figure can be changed simply by changing that constant's value. The example output shown is at a constant size of 3, but if you change the constant, the figure should grow larger and wider proportionally.

    +===+===+
    | | |
    | | |
    | | |
    +===+===+
    | | |
    | | |
    | | |
    +===+===+

    Any help would be appreciated. Thank you!

  • #2
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,662
    Thanks
    41
    Thanked 189 Times in 188 Posts
    well everything is in set's of three's... so does everything grow so there would be 4 +'s wide and 4 +'s high and so on?
    eg
    Code:
    +====+====+====+
    ||||
    ||||
    ||||
    ||||
    +====+====+====+
    ||||
    ||||
    ||||
    ||||
    +====+====+====+
    ||||
    ||||
    ||||
    ||||
    +====+====+====+
    now is doesn't look like an E anymore- so need to clarify that. This is going to be similar to the last project you did, you need to do some loops. Post what you have so far.

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


  •  

    Posting Permissions

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