Pseudocode

Pseudocode - Add 1 to lineCounter Flowchart design (may be...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Drawing 2: ……. .% …….% ……% …..% ….% Analysis of Drawing 2 Drawing 2 consists of 5 lines of text. Each line begins with a series of dots and ends with the % character. A new line character is also present which creates the next line. The first line has 8 dots and each line after that has one dot less than the previous line so that there are only 4 dots on the fifth line. Pseudocode design for Drawing 2 lineCounter = 0 While lineCounter < 5, repeat: dotCounter = lineCounter While dotCounter < 8, repeat: o Print “.” o Add 1 to dotCounter Print “%” and start new line
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Add 1 to lineCounter Flowchart design (may be hand drawn on paper) Coded implementation of Drawing 2 output += Use a nested loop to do this:\n for (int lineCounter = 0; lineCounter &lt; 5; lineCounter++) { for (int rowCounter = lineCounter; rowCounter &lt; 8; rowCounter++) { output += .; } output += %\n; } Another pseudocoding tips how to write an if statement using pseudocode: If the column position is even Print in the next letter in uppercase Else Print in the next letter in lowercase...
View Full Document

Ask a homework question - tutors are online