Answered You can buy a ready-made answer or pick a professional tutor to order an original one.

QUESTION

Other objectives include: •Use static methods. •Use local variables. •Use arithmetic expressions. •Use Scanner to input values. •Use a class constant. •Use for loops.

   Other objectives include:

•Use static methods.

•Use local variables.

•Use arithmetic expressions.

•Use Scanner to input values.

•Use a class constant.

•Use for loops. 

                              Tasks

               Write a program that prints

      Project 1 written by YOURNAME

and calls two methods:

1.The first method should print a sequence of text boxes.

 The draw Box method on p. 32 prints one text box, but your method should print a user-specified number of text boxes from left to right. This method should ask the user to enter the number of boxes, and then print that many text boxes horizontally.

2.

The second method should print a two-dimensional pattern of text tiles 

described below. This method should ask the user for the width and the height of the pattern, and then print the corresponding pattern.

Here is an example of what your output should look like (user input is in bold   and underlined):

Enter number of boxes: 

3

+------+------+------+

|     |      |      |

|     |      |      |

+------+------+------+

Enter width of pattern: 

3

Enter height of pattern: 

2

X   X    X

/ \ / \  / \

/  \/   \/   \

\  /\   /\   /

\ / \ /  \ /

X   X    X

/ \ / \  / \

/  \/   \/   \

\  /\   /\   /

\ / \ /  \ /

X   X    X

You can find this text pattern and many others 

at

http://www.retrojunkie.com/asciiart/designs/designs.htm

Details

The Console 

You will need to use Scanner to obtain input from the keyboard. You should declare a class constant of type Scanner named CONSOLE at the beginning of your class; you should store new Scanner (System.in) in CONSOLE See examples in the Chapter 2 

lecture notes and in the Laboratory 2 assignment. 

                Pattern of Text Boxes

The first two lines of code in this method should prompt the user for the number of boxes and input the value from the user. Below, it is assumed that this value is stored innumBoxes.

The rest of the code should print the boxes. The pattern of text boxes consists of 4 lines. In your program, you will need a for-loop to print each line. The following is the pseudocode for printing the first line.

Pseudocode for Printing the First Line of the Boxes

1.Print "+" (a plus sign).

2.For each value of I from 1 to numBoxes: 

               A.   Print “------+".

3. Print "\n” (a newline).  

Note that one + and one newline are printed outside the for loop. The remaining 3 for loops follow a similar pattern.

(Note: the top and bottom lines are the same; the two lines in the middle are the same as well. You may use additional methods to simplify your program.)

Two-Dimensional Pattern of Text Tiles

The first four lines of code in this method should prompt the user for the width and the height of the pattern and should input the values from the user. Below, it is assumed that the width is stored in widthand the height is stored in height.

The rest of the code should print the pattern. Note that there are 3 lines of 'X' for the pattern with the height of 2. That is, the lines of 'X' is one more than the pattern height. Therefore, you can print the first line of 'X'; then, each row of the pattern will be identical. This suggests the following pseudocode:

Pseudocode for Printing the Pattern of Text Tiles

          1. Print first line of 'X'.

             2. For each value of I from 1 to height:

                       A. Print one row of the diamond shape with '/' and '\';

                       B. Print the bottom line of 'X'.

Each of the 3 Print steps above can be implemented by a for-loopwith width 

where two of the for loops are inside the for loop described in the above pseudocode. Consider the pseudocode for printing the first line for one row of the diamond shape:

Pseudocode for Printing the first line of one row of the diamond shape:

1.   For each value of j from 1 to width:

A.  Print " / \\"

2.   Print "\n” (a newline).

Note that printing a backslash requires an escape sequence.

 The for loops for printing 

the other three lines of the diamond shape follow a similar pattern

Show more
3cubedeveloper
3cubedeveloper
  • @
  • 838 orders completed
ANSWER

Tutor has posted answer for $30.00. See answer's preview

$30.00

***** ********************* ****** **** *** answer * ******** quite *** *** ***** ** *** second method **************** ****** *** ****** ****** *** got *** ****** code file the ***** file *** the ****** **** ****** ****** **** name ** *** *********** ***** * **** indicated "YOURNAME" Please don't ******** ** ping ** ** anything ** amissKind *******

Click here to download attached files: Patterns.zip
or Buy custom answer
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question