Question: Fixing code only _________________ Write a java program that will collect the following 4 inputs from the user: width of the box height of the

Fixing code only

_________________

Write a java program that will collect the following 4 inputs from the user:

width of the box

height of the box

border character

interior character

Your program must collect the inputs in the order described above.

With these inputs, your program must print out a box made of the border and interior characters, and with the specified height and width. Here are some examples of what the program should look like when it runs with several different inputs:

Example 1

Enter width : 7 Enter height : 5 Enter border : X Enter interior : O XXXXXXX XOOOOOX XOOOOOX XOOOOOX XXXXXXX 

Example 2

Enter width : 4 Enter height : 3 Enter border : + Enter interior : * ++++ +**+ ++++ 

Example 3

Enter width : 9 Enter height : 4 Enter border : $ Enter interior : . $$$$$$$$$ $.......$ $.......$ $$$$$$$$$ 

For the given inputs, make sure that your program output looks exactly like the example above (including spelling, capitalization, punctuation, spaces, and decimal points).

Hints and Helpful Info

It can help to break this process down into steps.

To print the box, you must print a number of lines of text (specifically height lines of text)

For each line of text that you print, you must print a number of characters (Specifically width characters)

Each character is either a border character or an interior character

You can use a loop to iterate through each line of the box

You can use a nested loop to iterate through each character in this line of the box

You can use a decision statement to decide to print either a border character or an interior characterFor example,

if the current line is the first line, then the printed character will be the border character

if the current character is the first character on this line, then the printed character will be the border character

etc.

After each line, you can print a newline character to start the next line

the code:

import java.util.Scanner; class Main { static void pattern(int rows, int cols, char ch,char ch1) { int i, j; for (i = 1; i 

_______________________________________

the Expected output must be the same in pic below

Fixing code only _________________ Write a java program that will collect the

2.Logic Test 02 0/25 Outout differs. See highlights below

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!