CS 305j - 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.

Goals:
• Learn to remove redundancy from your programs through the use of static methods.
• Produce a structured solution that uses static methods to solve each part of the problem.
• Decompose a complex problem into simpler parts.
• Practice identifying and using appropriate class constants.

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.

/**
* @version <Date>
* CS305J 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:

• review the assignment requirements?
• work on this assignment individually?
• check for compile errors and runtime errors in your program?
• use concepts from chapters 1-3 only? You are allowed, but not required, to use parameters - if you do not have prior programming experience, I do NOT recommend the use of parameters.
• include a comment for each method that describes what the method does?
• turn in your Java source code, your file Rocketship.java to your cs 305j folder via the turnin program?
• submit your program by the due date at 11 pm?