AP Computer Science :: Projects :: Loopy Designs
Problem
Create the following class:
public class LoopyRectangle { public static void main(String[] args) { final int LENGTH = 11; for (int i = 1; i <= LENGTH; i++) { for (int j = 1; j <= LENGTH; j++) System.out.print("*"); System.out.println(""); } } }
The code above should generate a rectangle of stars. Create a class for each of the following scenarios using for loops:
Scenario 1: Triangle
Scenario 2: Pyramid
Scenario 3: Diamond
Scenario 4: Diamond Outline
Instructions
- You can create more code than just the pair of for loops created in the original example.
- Create a different class for each scenario.
- There is no rubric for this project. Each scenario is worth 10 points and it either works or it doesn't.
Project Extension
Create your own scenario and create it using stars.