logo CodeStepByStep logo

SpaceNeedle2

Write a complete program in a module named SpaceNeedle2 with a Main subroutine that prints the following figure as console output.

Use subroutines to capture the structure of the figure and to eliminate redundancy. For example, no complete line of output should be printed in two or more places in your code.

Use loops to capture repeated patterns of characters within each line of output. For example, if you see a pattern of five / characters in a row, use a loop that repeats 5 times to print the character.

Assume the existence of a global constant named SIZE, not declared by your code, that controls the figure's size. It should be possible to print figures of different sizes by changing only this constant. The example outputs shown represent the figure at size of 10 and size of 14.

Output SIZE 4:

            ||
            ||
            ||
            ||
         __/||\__
      __/:::||:::\__
   __/::::::||::::::\__
__/:::::::::||:::::::::\__
|""""""""""""""""""""""""|
\_/\/\/\/\/\/\/\/\/\/\/\_/
  \_/\/\/\/\/\/\/\/\/\_/
    \_/\/\/\/\/\/\/\_/
      \_/\/\/\/\/\_/
            ||
            ||
            ||
            ||
         |%%||%%|
         |%%||%%|
         |%%||%%|
         |%%||%%|
         |%%||%%|
         |%%||%%|
         |%%||%%|
         |%%||%%|
         |%%||%%|
         |%%||%%|
         |%%||%%|
         |%%||%%|
         |%%||%%|
         |%%||%%|
         |%%||%%|
         |%%||%%|
         __/||\__
      __/:::||:::\__
   __/::::::||::::::\__
__/:::::::::||:::::::::\__
|""""""""""""""""""""""""|

Output SIZE 6:

                  ||
                  ||
                  ||
                  ||
                  ||
                  ||
               __/||\__
            __/:::||:::\__
         __/::::::||::::::\__
      __/:::::::::||:::::::::\__
   __/::::::::::::||::::::::::::\__
__/:::::::::::::::||:::::::::::::::\__
|""""""""""""""""""""""""""""""""""""|
\_/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\_/
  \_/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\_/
    \_/\/\/\/\/\/\/\/\/\/\/\/\/\_/
      \_/\/\/\/\/\/\/\/\/\/\/\_/
        \_/\/\/\/\/\/\/\/\/\_/
          \_/\/\/\/\/\/\/\_/
                  ||
                  ||
                  ||
                  ||
                  ||
                  ||
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
             |%%%%||%%%%|
               __/||\__
            __/:::||:::\__
         __/::::::||::::::\__
      __/:::::::::||:::::::::\__
   __/::::::::::::||::::::::::::\__
__/:::::::::::::::||:::::::::::::::\__
|""""""""""""""""""""""""""""""""""""|
Function: Write a VB function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.