CS 312 - Programming Assignment 3
Problem Decomposition, static methods and for loops

This is an individual assignment - you cannot work with anyone else. All work must be done on your own. Ask the instructional staff if you need help.

Make sure that you are following the program style guidelines (see the course webpage).

Goals:


For this assignment, you will write a Java program Rocketship.java that produces the following output:

     /**\
    //**\\
   ///**\\\
  ////**\\\\
 /////**\\\\\
+=*=*=*=*=*=*+
|../\..../\..|
|./\/\../\/\.|
|/\/\/\/\/\/\|
|\/\/\/\/\/\/|
|.\/\/..\/\/.|
|..\/....\/..|
+=*=*=*=*=*=*+
|\/\/\/\/\/\/|
|.\/\/..\/\/.|
|..\/....\/..|
|../\..../\..|
|./\/\../\/\.|
|/\/\/\/\/\/\|
+=*=*=*=*=*=*+
     /**\
    //**\\
   ///**\\\
  ////**\\\\
 /////**\\\\\

Your program must produce this output exactly. You are also required to use a structured, general solution that will produce the output below if you change the value of a single constant in your program:

The purposes of this assignment are:
  1. To decompose a complex problem into simpler parts
  2. To use loops to be able to generalize a problem
  3. To practice writing static methods
  4. To practice using print and println statements
  5. To practice identifying and using appropriate program constants.

Complete a program named Rocketship.java. The program is to produce the following output.

     /**\
    //**\\
   ///**\\\
  ////**\\\\
 /////**\\\\\
+=*=*=*=*=*=*+
|../\..../\..|
|./\/\../\/\.|
|/\/\/\/\/\/\|
|\/\/\/\/\/\/|
|.\/\/..\/\/.|
|..\/....\/..|
+=*=*=*=*=*=*+
|\/\/\/\/\/\/|
|.\/\/..\/\/.|
|..\/....\/..|
|../\..../\..|
|./\/\../\/\.|
|/\/\/\/\/\/\|
+=*=*=*=*=*=*+
     /**\
    //**\\
   ///**\\\
  ////**\\\\
 /////**\\\\\

Your program is to reproduce this output exactly. Getting the correct output is only half of the assignment though. The other half is to create a well structured, general solution. By simply changing the value assigned to a single constant in your program your program should then be able to produce the following output.

             /**\
            //**\\
           ///**\\\
          ////**\\\\
         /////**\\\\\
        //////**\\\\\\
       ///////**\\\\\\\
      ////////**\\\\\\\\
     /////////**\\\\\\\\\
    //////////**\\\\\\\\\\
   ///////////**\\\\\\\\\\\
  ////////////**\\\\\\\\\\\\
 /////////////**\\\\\\\\\\\\\
+=*=*=*=*=*=*=*=*=*=*=*=*=*=*+
|....../\............/\......|
|...../\/\........../\/\.....|
|..../\/\/\......../\/\/\....|
|.../\/\/\/\....../\/\/\/\...|
|../\/\/\/\/\..../\/\/\/\/\..|
|./\/\/\/\/\/\../\/\/\/\/\/\.|
|/\/\/\/\/\/\/\/\/\/\/\/\/\/\|
|\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
|.\/\/\/\/\/\/..\/\/\/\/\/\/.|
|..\/\/\/\/\/....\/\/\/\/\/..|
|...\/\/\/\/......\/\/\/\/...|
|....\/\/\/........\/\/\/....|
|.....\/\/..........\/\/.....|
|......\/............\/......|
+=*=*=*=*=*=*=*=*=*=*=*=*=*=*+
|\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
|.\/\/\/\/\/\/..\/\/\/\/\/\/.|
|..\/\/\/\/\/....\/\/\/\/\/..|
|...\/\/\/\/......\/\/\/\/...|
|....\/\/\/........\/\/\/....|
|.....\/\/..........\/\/.....|
|......\/............\/......|
|....../\............/\......|
|...../\/\........../\/\.....|
|..../\/\/\......../\/\/\....|
|.../\/\/\/\....../\/\/\/\...|
|../\/\/\/\/\..../\/\/\/\/\..|
|./\/\/\/\/\/\../\/\/\/\/\/\.|
|/\/\/\/\/\/\/\/\/\/\/\/\/\/\|
+=*=*=*=*=*=*=*=*=*=*=*=*=*=*+
             /**\
            //**\\
           ///**\\\
          ////**\\\\
         /////**\\\\\
        //////**\\\\\\
       ///////**\\\\\\\
      ////////**\\\\\\\\
     /////////**\\\\\\\\\
    //////////**\\\\\\\\\\
   ///////////**\\\\\\\\\\\
  ////////////**\\\\\\\\\\\\
 /////////////**\\\\\\\\\\\\\


Note that in the original rocketship, the various subfigures have a height of 3. The height of these subfigures also determines their width, so there is only need one constant for the size of the rocket. You must use a class constant to make it possible to change a single number in one place in the program to produce a rocket with a different size. Note that the larger example rocket above has size/height of 7.

This assignment is meant to give you practice with the constructs from chapters 1 and 2 of the textbook (i.e., print(), println(), static methods, decomposition, loops, nested loops, class constants). This will require you to create nested for loops with print and println statements that use the class constant. If you are interested, you may use the constructs from chapter 3, although you do not need them and you will not receive extra credit for doing so. You are not allowed to use any programming constructs that are not included in chapters 1 to 3 in our textbook.

You must use static methods to structure your solution. You should avoid significant redundany and you should structure your program in such a way that the methods match the structure of the output itself. You are required to indent your source code properly, and you will lose points if your indentation is not readable and consistent. You are also required to use meaningful identifiers, whitespace and comments to make your program readable. You should only have one class constant.

Include the following header at the top of your Rocketship.java file:
/**
 * @author  <Your name here>
 * @version <Date>
 * CS312 Lab 3
 * On my honor, <NAME>, this programming assignment is my own work.
 *
  * A program to print out a rocket ship.
 *
 * Slip days information.
 * Number of slip days I am using on this assignment:
 * Number of slip days I think I have so far this semester
 * including this assignment:
 */

On any given execution your program will produce only one version of the rocketship, though it will be possible to change the class constant to have the program produce a figure of a different size. The program you submit should produce the first rocketship displayed above (i.e., the one with height 3).

When you are finished, submit your Rocketship.java file using the turnin program.



Did you remember to: