Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[IN JAVA] This program is broken down into phases for your convenience only. Please turn in only your final product. Phase 1: Write a program

[IN JAVA]

This program is broken down into phases for your convenience only. Please turn in only your final product.

Phase 1:Write a program that draws a rocket on the screen. Here's what the rocket should look like:

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

Your main method in phase 1 must look like this:

 public static void main(String[] args) { drawCone(); drawBox(); drawBox(); drawCone(); } 

You may simply use three println() statements (no loops are necessary) in your drawCone() method. For your drawBox() method, you must use the drawHorizontalLine(), draw2VerticalLines(), and drawOneRow() methods exactly as they appear in lesson 6. For phase 1 you'll be using the versions from lesson 6.3

Phase 2: In this phase you will allow the user to specify three things:

  1. the height of each stage
  2. the width of each stage
  3. how many stages in the rocket

[A "stage" in your rocket is one rectangle. The example rocket above has a stage-height of 6, a stage-width of 5, and the number of stages is 2.]

Your main method in phase 2 must look like this:

 public static void main(String[] args) { <6 statements to prompt for and read the stage-height, stage-width, number of stages.> drawRocket(); } 

You must still use the drawHorizontalLine(), draw2VerticalLines(), and drawOneRow() methods exactly as they appear in lesson 6. For phase 2 you'll be using the versions from lesson 6.6.

Notice that if you run the program and choose a different width for your stages, the cone won't really fit correctly anymore. I won't make you fix this, but you can fix it for 5 points of extra credit if you like. However, I will not help you with the extra credit. In order to get the extra credit, the number of rows of your cone must be equal to the width of the stages divided by 2 (plus 1 for odd widths). If the stage width is an even number, your cone must have two stars in the top row instead of one. If you do this perfectly and use good decomposition in the process you'll get 5 extra credit points.

Phase 3: In this phase you won't change what the program produces. We're just going to improve on the organization a bit. Change your program so that the main function looks like this:

 public static void main(String[] args) { {  stageWidth = getWidth(); stageHeight = getHeight(); numStages = getNumStages(); drawRocket(); } 

You must still use the drawHorizontalLine(), draw2VerticalLines(), and drawOneRow() functions exactly as they appear in lesson 6. They should remain unchanged from phase 2. You must also use the drawBox() function exactly as it appears in lesson 6.8.

When you submit your work, a single run of the program will suffice, unless you do the extra credit, in which case you should show examples of both even and odd cone widths. Also, don't worry if your rocket no longer looks right after you paste it into your file. This won't affect your grade.

Please make sure to place a detailed comment above each of your method definitions, use good decomposition, and separate your methods with at least 6 blank lines.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

5. Discuss the key roles for training professionals.

Answered: 1 week ago