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 YOURNAMEand 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: 3Enter height of pattern: 2X X X/ / / / / / \ / / / / / /X X X/ / / / / / \ / / / / / /X X XYou can find this text pattern and many others athttp://www.retrojunkie.com/asciiart/designs/designs.htmDetailsThe 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 BoxesThe 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 Boxes1.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 TilesThe 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
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: +——+——+——+ | | | | | | | | +——+——+——+ Enter width of pattern: Enter height of pattern: 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 width and 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-loop with 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: For each value of j from 1 to width: Print ” / \” 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
Why Choose Us
- 100% non-plagiarized Papers
- 24/7 /365 Service Available
- Affordable Prices
- Any Paper, Urgency, and Subject
- Will complete your papers in 6 hours
- On-time Delivery
- Money-back and Privacy guarantees
- Unlimited Amendments upon request
- Satisfaction guarantee
How it Works
- Click on the “Place Order” tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
- Fill in your paper’s requirements in the "PAPER DETAILS" section.
- Fill in your paper’s academic level, deadline, and the required number of pages from the drop-down menus.
- Click “CREATE ACCOUNT & SIGN IN” to enter your registration details and get an account with us for record-keeping and then, click on “PROCEED TO CHECKOUT” at the bottom of the page.
- From there, the payment sections will show, follow the guided payment process and your order will be available for our writing team to work on it.