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:
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.
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.
public class PatternMaker
public static void main(String args)
boolean flag = true;
Scanner inp = new Scanner(System.in);
System.out.println("Enter number of rows: ");
row = inp.nextInt();
System.out.println("Enter number of columns: ");
column = inp.nextInt();
System.out.println("Enter first string: ");
first = inp.next();
System.out.println("Enter second string: ");
second = inp.next();
System.out.println("Enter separator: ");
separator = inp.next();
for(int x = 0; x < row; x++)
for(int y = 0; y < column; y++)
flag = false;
flag = true;
if(y != column-1)
Sample Output 1:
Sample Output 2:
Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*See Solution
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