Question: JAVA LANGUAGE - Follow the instructions as closely as possible. Comments are welcomed Require .txt file: config.txt int //size int /umber of logos char //first
JAVA LANGUAGE - Follow the instructions as closely as possible. Comments are welcomed
Require .txt file: "config.txt"
int //size
int /umber of logos
char //first letter
char //second letter

Summary
Extend your understanding of Repetition Control Structures by building a picture of triangles. This picture will be configurable with respect both triangle size and the number of triangle rows, as specified by a configuration file your program will parse.
Introduction Sample Executions
Your assignment is to write a program that draws rows and rows of triangles. It may be easier to view sample executions of such a program, and so Ive included some below. Your program will read from an input file (config.txt) the size of each triangle and the number of rows of triangles using the Scanner technique covered in class or lab. In addition, your software will read in two characters from the input file, and use those characters to draw the triangle picture.


For added challenge, try using JOptionPane.showMessageDialog(null, new JTextArea(String)) to display the triangle string pattern you have created
Empirical & Black Box Analysis
Black Box testing focuses on the external behaviours of a system while specifically ignoring the internal design details (which may not be available, either, as it is in this case). Studying the output in the figures above will reveal these invariants that should be built into your software:
(1) The number of triangles for a given row is proportional to the depth of the row. a. So row 1 has 1 triangle, row 2 has two triangles, etc.
(2) The number of rows internal to a triangle is proportional to the size of the triangle.
(3) Ultimately, youre building one big box where every line (or row) is composed of (nested) looping patterns similar to the following pseudocode: Loop(on number of rows)
Loop(draw left border(s)) (0 to many times)
Loop(draw triangle(s)) (0 to many times) /ote this one step expands to a similar pattern
Loop(draw right border(s)) (0 to many times)
Note that the draw triangle(s) step bolded above actually represents multiple sub-steps, just as a method call actually represents multiple lines of code (although one line methods do exist). Every triangle is composed of a left border of stars, the spaces that compose the internal triangle, and then the right border. Determining just how many stars, spaces, and then stars to print is up to you. Using the pattern above as a template, you should add the additional sub-steps omitted above before the pseudocode is detailed enough to be simply translated into code.
Program Requirements
There exists many ways to build this code, but the requirements stay the same. Your software should:
(1) Read in 4 data items from a sequential text file using Scanner.
(2) Draw a picture composed of triangles, using the input data to determine:
a. How large each triangle will be (triangle size)
b. How many rows of triangles will be displayed (row count)
c. What character should be used to draw the triangles (char 1)
d. A second character used to draw the space around the triangles (char 2)
(3) Your output should be compared against the sample output for accuracy.
a. Note that the number of triangles drawn per row is directly proportional to the row count itself. So, for the first row, one triangle is drawn, and for the second row, two, and so on.
(4) Break up this program into smaller functions and call those
a. You can call a function inside of a loop
Use as many Comments as possible
E ? config.txt 1 int //size 2 int /umber of logos 3 char //first letter 4 char //second letter
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
