First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects). Then create a new Java application called "PatternMaker" (without the quotation marks) according to the following guidelines. The program prompts the user for five input values: An integer value between 1 and 10 (inclusive) for the number of rows to be printed A second integer value between 1 and 10 (inclusive) for the number of columns to be printed A string value for the starting string of the pattern A string value for the second string of the pattern A string value that separates the first two strings The program must use nested for loops to print a rectangular array of alternating first and second strings of the pattern, separated by the separator string and such that the first string in the first row uses the "first string" provided by the user, but each subsequent row alternates the starting string between the "second string" the user provided and the "first string" the user provided. So, for instance, if the user enters 5 for the number of rows, 7 for the number of columns, and "XX" for the first string, "OO" for the second string, and "***" for the separator, your program should print the following rectangular pattern. XX***OO***XX***OO***XX***OO***XX OO***XX***OO***XX***OO***XX***OO XX***OO***XX***OO***XX***OO***XX OO***XX***OO***XX***OO***XX***OO XX***OO***XX***OO***XX***OO***XX Thoughts Note the requirement for this program to use nested for loops (Horstmann section 4.3). Note that there is no delimiter at the end of the lines. The logic needed for the nested for loops is a bit tricky. Try writing out the logic for simple cases (e.g., 2 rows and 3 columns). Include multiple runs of this program using a variety of values for the three input strings. Copy and paste all of your sample runs in your source code as a block comment at the bottom below the closing curly brace.

Question

First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects).

Then create a new Java application called "PatternMaker" (without the quotation marks) according to the following guidelines.

The program prompts the user for five input values:

  1. An integer value between 1 and 10 (inclusive) for the number of rows to be printed
  2. A second integer value between 1 and 10 (inclusive) for the number of columns to be printed
  3. A string value for the starting string of the pattern
  4. A string value for the second string of the pattern
  5. A string value that separates the first two strings

The program must use nested for loops to print a rectangular array of alternating first and second strings of the pattern, separated by the separator string and such that the first string in the first row uses the "first string" provided by the user, but each subsequent row alternates the starting string between the "second string" the user provided and the "first string" the user provided.

So, for instance, if the user enters 5 for the number of rows7 for the number of columns, and "XX" for the first string, "OO" for the second string, and "***" for the separator, your program should print the following rectangular pattern.

XX***OO***XX***OO***XX***OO***XX

OO***XX***OO***XX***OO***XX***OO

XX***OO***XX***OO***XX***OO***XX

OO***XX***OO***XX***OO***XX***OO

XX***OO***XX***OO***XX***OO***XX

Thoughts

  • Note the requirement for this program to use nested for loops (Horstmann section 4.3).
  • Note that there is no delimiter at the end of the lines.
  • The logic needed for the nested for loops is a bit tricky. Try writing out the logic for simple cases (e.g., 2 rows and 3 columns).

Include multiple runs of this program using a variety of values for the three input strings. 
Copy and paste all of your sample runs in your source code as a block comment at the bottom below the closing curly brace.

Expert Answer

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times vary by subject and question complexity. Median response time is 34 minutes and may be longer for new subjects.

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: public static int createMirror(String str) write your code to calculate the number of characters tha...

A: A Java program is created to calculate the number of characters to be removed from a string to make ...

Q: Question 3: Declare a vector with... a) An empty vector holding int elements b) A vector with size 3...

A:  Declaring the vector:a) Empty vector holding “int” elements:vector<int> intVector;Here, “intV...

Q: What are the risks associated with a pervasive security infrastructure? What are the reasons for NOT...

A: Pervasive security infrastructure refers to cloud security risks. As many users possibly from differ...

Q: Python 3.7.4 Given four files named asiasales2009.txt, europesales2009.txt, africasales2009.txt, and...

A: Statements for creating objects:#for first file asiasales2009.txt for writingasia = open("asiasales2...

Q: Provide a situation that encompasses Integrity in the CIA triad

A: DefinitionIntegrity plays the foremost role in CIA triad. It is designed to secure the data from an ...

Q: First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ...

A: Launch the NetBeans IDE.

Q: Write an application starting with ProjectTemplate. Name the class AgeCalcApp. The app needs to prom...

A: To write an application name ProjectTemplate with the class name AgeCalcApp. This application prompt...

Q: Problem 1 consists of multiple parts. You should finish one part and ensure that it works before mov...

A: Hello. Since your question has multiple sub-parts, we will solve first three sub-parts for you. If y...

Q: Using the following truth table, write the equivalent Boolean equations in Sum of Product and Produc...

A: Simplification of Sum Of Products (SOP):The truth table of the SOP is as follows