Yorkville High School Computer Science Department
Yorkville High School Computer Science Department on Facebook  Yorkville High School Computer Science Department Twitter Feed  Yorkville High School Computer Science Department on Instagram

Yorkville High School Computer Science

ASSIGNMENTS: Random Numbers in Parallel - November 21, 2017

Computer Programming I :: Projects :: Right Triangle

Problem

You are going to design a program that will draw a right triangle in a label. The right triangle should be drawn using a character on the keyboard such as "*" and should be 10 characters tall. Instead of setting the label text using =, use += to add the rows to the label instead of replacing the previous rows. The triangle should look somewhat like the one below.

*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * * * *
* * * * * * * * *
* * * * * * * * * *

Specific Requirements

  1. Use "\n" to create a new line in the code.
  2. Use a count variable to keep track of the row.
  3. Use a while loop to traverse the rows and a second while loop to create the stars in each row.
  4. Clear the label before the loop by setting the text equal to "", which is known as the empty string.
  5. Rename the form and all controls on the form using a three-letter prefix.
  6. Add a comment header following class guidelines.

Project Extension

1. Allow the user to enter the number of rows they want.

2. Create a second pattern in addition to the right triangle.

Yorkville High School Computer Science Department on Facebook Yorkville High School Computer Science Department Twitter Feed Yorkville High School Computer Science Department on Instagram