CS 1054 Project 3 Extra Credit: Printing V and N

Instructions

  1. Create a LetterV class (5 points) and a LetterN class (5 points). Both classes should have a toString() method that returns a String. The string returned should consist of asterisks, newlines, and spaces (as necessary). Each of these classes should also have a single-parameter constructor indicating the size/height of the letter. (Note that the width of the letter will follow from the height). You may assume that the height provided in the constructor is at least 4.
  2. Test your classes against this code:
          LetterV v1 = new LetterV( 7 );
          System.out.println(v1.toString());      
          LetterV v2 = new LetterV( 4 );
          System.out.println(v2.toString());      
    
          LetterN N1 = new LetterN( 5 );
          System.out.println(N1.toString());      
          LetterN N2 = new LetterN( 10 );
          System.out.println(N2.toString());      
    
    The following output should result:
    *           *
     *         *
      *       *
       *     *
        *   *
         * *
          *
    
    *     *
     *   *
      * *
       *
    
    *   *
    **  *
    * * *
    *  **
    *   *
    
    *        *
    **       *
    * *      *
    *  *     *
    *   *    *
    *    *   *
    *     *  *
    *      * *
    *       **
    *        *
    
    
  3. Submission: Zip both java programs and submit through http://web-cat.cs.vt.edu (it will be under a different project label).