Question: I need help writing this program in JAVA, this is an introductory java course, so if possible, keep it as basic/simple as possible while still

I need help writing this program in JAVA, this is an introductory java course, so if possible, keep it as basic/simple as possible while still following the instructions. The output should look like the sample execution at the end of the problem.

Write a program which asks the user to enter the size of a grid and display the corresponding grid. The dimensions of the grid will be the same in each dimension, so if the user enters 4, you would display a 4 x 4 grid. If the user enters 10, you would display a 10 x 10 grid, and so on. See below for examples.

Input Validation:

The size of the grid must be a positive integer.

Requirements:

You must design your program to use methods correctly.

You must design your program to theoretically work for any input value.

Hints:

You might want to have a method that takes the grid size and prints one line of the grid that has the plus signs: +--+--+--+--+--+

You might want to have a method that takes the grid size and prints one line of the grid that has the vertical pipes: | | | | | |

You might want to have a method that takes the grid size and using the previous two methods, display the correct result.

Choose your return types wisely.

Sample Execution 1:

Enter the size of the grid: 1 +--+ | | +--+ 

Sample Execution 2:

Enter the size of the grid: 5 +--+--+--+--+--+ | | | | | | +--+--+--+--+--+ | | | | | | +--+--+--+--+--+ | | | | | | +--+--+--+--+--+ | | | | | | +--+--+--+--+--+ | | | | | | +--+--+--+--+--+ 

Sample Execution 3:

Enter the size of the grid: 10 +--+--+--+--+--+--+--+--+--+--+ | | | | | | | | | | | +--+--+--+--+--+--+--+--+--+--+ | | | | | | | | | | | +--+--+--+--+--+--+--+--+--+--+ | | | | | | | | | | | +--+--+--+--+--+--+--+--+--+--+ | | | | | | | | | | | +--+--+--+--+--+--+--+--+--+--+ | | | | | | | | | | | +--+--+--+--+--+--+--+--+--+--+ | | | | | | | | | | | +--+--+--+--+--+--+--+--+--+--+ | | | | | | | | | | | +--+--+--+--+--+--+--+--+--+--+ | | | | | | | | | | | +--+--+--+--+--+--+--+--+--+--+ | | | | | | | | | | | +--+--+--+--+--+--+--+--+--+--+ | | | | | | | | | | | +--+--+--+--+--+--+--+--+--+--+ 

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!