Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in java language Topics This assignment will give you practice with for loops, static methods, print / println statements and a class constant. This assignment
in java language
Topics
This assignment will give you practice with for loops, static methods, printprintln statements and a class constant. This assignment is worth points instead of the normal points.
the method should be like this :
public static void drawBody
for int line ; line HEIGHT; line
System.out.print;
for int i ; i line ; i
System.out.print;
for int i ; i line HEIGHT ; i
System.out.print;
for int i ; i line ; i
System.out.print;
System.out.println;
Details
You are going to generate output that looks like the following height of :
~~~~~~~~~~
~~~~~~~~~~
Instructions
You are to write a program that can produces an ASCII Art picture.
You should use nested loops to reduce repeating code for specific characters on a given line.
You should use static methods to structure your solution in order to reduce repeating code for repetitious subfigures.
You are required to properly indent your code and will lose points if you make indentation mistakes.
You should begin by trying to reproduce the figure above exactly. Once you can reproduce this firecracker, you should introduce a class constant to your code to make your solution more flexible in order to allow firecrackers of different sizes to be produced.
Class Constant
Unlike previous programs, this program can have varying output results based on the value assigned to a single class constant. This class constant determines the height of the firecracker. The firecracker shown above has a height of
Define a class constant to make it possible to change a single number in one place in the program to have it produce a corresponding figure of a different size. When you submit your code, it does not matter what the value of your constant is set at as I will change the constant to test your code for various output results.
On any given execution your program will produce just one version of this figure.
For example, with a height of the output should look like this:
~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~
Hint
This video Complex ASCII Figures Links to an external site. will help with understanding the formulaic approach to this problem, including the development of forloops and proper use of the class constant in order to solve the problem.
Homework Submission
Comments
Include a comment at the beginning of your program with the following information and a description of the program in your own words:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started