{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Ch02-5 - Ch.2.5 1 | | | | | | |*

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Drawing complex figures Ch. 2.5
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 Drawing complex figures Write Java code to produce the following output. Write nested  for  loops to capture the repetition. Use a constant so that the size of the figure could be changed simply by  modifying one line of your program. #*********# | ******* | | ***** | | *** | | * | | * | | *** | | ***** | | ******* | #*********# (it's supposed to look like  an hourglass...)
Background image of page 2
3 Drawing complex figures When the task is as complicated as this one, it may help to  write down some steps on paper before we write our code: 1. A  pseudo-code  (written in English) description of the algorithm 2. A table of each line's contents, to help see the pattern in the input #*********# | ******* | | ***** | | *** | | * | | * | | *** | | ***** | | ******* | #*********#
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4 Pseudo-code pseudo-code : A written English description of an algorithm to  solve a programming problem. Writing pseudo-code for a complicated program can help us get the main 
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}