Java Basics Track for A290/A590 Spring 2008
Reference: Cay Horstmann's Core Java volume I (Fundamentals)
For additional references available on-line for free from Books24x7 please see the Intro track


Tue Apr 8 10:54:02 EDT 2008 Problem Two:

Write a program that produces scalable patterns as detailed below.

The program should ask the user for an integer then draw a Z at that size.

Behaviour is not specified if the user enters anything but a positive integer.

Here's an idea how your program should work. Your program need only be reasonably similar.

The design of the Z is non-negotiable, though: four line segments, as shown.

-bash-3.1$ javac Two.java
-bash-3.1$ java Two
Welcome to the Scalable Z's program!
What size Z do you want? 13
* * * * * * * * * * * * * 
                      *   
                    *     
                  *       
                *         
              *           
      * * * * * * *       
          *               
        *                 
      *                   
    *                     
  *                       
* * * * * * * * * * * * * 
-bash-3.1$ java Two
Welcome to the Scalable Z's program!
What size Z do you want? 19
* * * * * * * * * * * * * * * * * * * 
                                  *   
                                *     
                              *       
                            *         
                          *           
                        *             
                      *               
                    *                 
        * * * * * * * * * * *         
                *                     
              *                       
            *                         
          *                           
        *                             
      *                               
    *                                 
  *                                   
* * * * * * * * * * * * * * * * * * * 
-bash-3.1$ java Two
Welcome to the Scalable Z's program!
What size Z do you want? 9
* * * * * * * * * 
              *   
            *     
          *       
    * * * * *     
      *           
    *             
  *               
* * * * * * * * * 
-bash-3.1$ 


Last updated by Adrian German for A290/A590 on Sun Apr 06 14:39:38 EST 2008