CSCI 161: Introduction to Programming I
Lab 2: Figure (Problem Decomposition and Methods)

Overview

Write a complete program that produces the figure below as output. Use static methods to capture the structure and eliminate redundancy from the output. Note: There should be no println statements in your main method, only calls to methods that do the actual printing.

Create a static method for each of the three main figures to capture the program's structure, and also create static methods for the repeated portions of each figure, to capture the program's redundancy.

Use good programming style: write comments, indent consistently, and use white space to make your program readable.

Input Specification

No input is required.

Output Specification

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


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


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

Required Methods

Use several static methods to eliminate redundancy. You should create a method for each figure, and methods for each part of the figures that are similar.

Hints

Create a new project called Figure for this lab. The basic steps are the same as in the first lab. If you are unsure about how to create a new project, see the Computing Tips document Creating a New Program.

Next create a new Java class file by clicking on the "New Java Class" button. Name the class (also as "Figure"). Under "Which method stubs would you like to create?", be sure to click on the box to create the "main" method.

Submission

Submit this as Lab2.


Dr. Blaise W. Liffick