For this assignment you are to complete the code for the Java Class, named Patterns, that contains
a main method and three additional methods that will print various patterns. The main method will
act as a test driver for this program in that it will make one call to each of the following three methods.
Complete the code for the method, named printPatterns(), that uses for loops to print the pat-
terns that follow. You should use two nested for loops for each pattern (so you will have four
separate sets of nested for loops when complete). Your method should use Sys-
tem.out.print(“#”); to print the pattern and System.out.print(“ “); to print spaces that will be
needed for formatting. You are not allowed to use System.out.print(“####”), then Sys-
tem.out.print(“###”), and then System.out.print(“##”) or anything similar to print the patterns,
you may only print one character at a time and use control structures (logic) to determine when
to print the pattern. You will need to use if/else statements within the loops to determine when
to print the pattern or a space. You will need to use System.out.println() to advance to the next
line in the pattern.
NOTE: Each of the following patterns should be printed separately and will appear vertically
(one below the other) on the screen when printed. They are shown horizontally on this specifi-
cation to save space.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # #
# # # # # # # # #
# # # # # # #
# # # # # # # # # # # # # # # # # #
Complete the code for the method, named printHorizontalBars(), that prompts the user for four
values and then draws corresponding bar graphs using an ASCII character. For example, if the
user entered 12, 9, 4 and 2 in that respective order, the program would draw.
* * * * * * * * * * * *
* * * * * * * * *
* * * *
* *
Complete the code for the method, named printVerticalBars(), that prompts the user for four
values and draws vertical bar charts using an ASCII character. A row of dashes should be dis-
played at the bottom of the chart. For example, if the user inputs 5, 2, 3, and 4, the program
should display.
**
** **
** ** **
** ** ** **
** ** ** **
------------------------------
The variables and methods defined within your Java class must include comments. Your program
should also be properly formatted, which includes indentation of code and package patterns;

import java.util.Scanner;

public class Patterns {


    // All of the code for the main method is complete.  No modifications are necessary.

    public static void main(String[] args) {

        // call method to print design patterns
        printPatterns();

        // call method to print horizontal bars
        printHorizontalBars();

        // call method to print vertical bars
        printVerticalBars();

    } // end main

    // Complete the code for the following method according to the project specifications.
    public static void printPatterns()    {

        System.out.println("printPatterns() method called....");

        // nested for loop to print the following pattern goes below:
        //    # # # # # # # #
        //	    # # # # # # #
        //	      # # # # # #
        //	        # # # # #
        //	          # # # #
        //	            # # #
        //	              # #
        //	                #

        // NOTE: You can copy the following nested-for loop structure and change it based on
        // each of the four patterns that you need to draw

   Remove comments before coding
        for (int row = 1; row <= 8; row++)  // add code to complete the for loop
        {
            for ( int col = 1; col<= 8; col++) // add code to complete the for loop
            {
                if (row + col == 9 || row == col || row = 1 || row 8) // add condition to if-statement
                {
                    // You can swap the following print statements based on the logic you wish to use

                    System.out.print("#"); // print space in pattern (you can swap with print statement below to make logic easier
                }
                        else
                System.out.print("  "); // print character for pattern

                System.out.println(); // move to next line of the pattern been printed

        }
 */


        // Tested for loop to print the following pattern goes below:
        //    # # # # # # # #
        //	  # # # # # # #
        //	  # # # # # #
        //	  # # # # #
        //	  # # # #
        //	  # # #
        //	  # #
        //	  #


        for (int row = 1; row <= 8; row++)  // add code to complete the for loop
        {
            for ( int col = 1; col<= 8; col++) // add code to complete the for loop
            {
                if (row + col <= 9) // add condition to if-statement
                {
                    // You can swap the following print statements based on the logic you wish to use

                    System.out.print("#"); // print space in pattern (you can swap with print statement below to make logic easier
                }
                else
                    System.out.print("  "); // print character for pattern

                System.out.println(); // move to next line of the pattern been printed

                System.out.println


        // nested for loop to print the following pattern goes below:
        //(HINT: what do the #'s on the top and bottom have in common.  What is the
        // relationship between row and column values...plug in numbers for their location
        // to help find the answers to the logic you need to use..think in terms of the
        // row and column value)
        //
        //    # # # # # # # #
        //	    #         #
        //	      #     #
        //	        # #
        //	        # #
        //	      #     #
        //	    #         #
        //	  # # # # # # # #

                for (int row = 1; row <= 8; row++)  // add code to complete the for loop
                {
                    for ( int col = 1; col<= 8; col++) // add code to complete the for loop
                    {
                        if (row + col == 9 || row == col || row = 1 || row 8) // add condition to if-statement
                        {
                            // You can swap the following print statements based on the logic you wish to use

                            System.out.print("#"); // print space in pattern (you can swap with print statement below to make logic easier
                        }
                        else
                            System.out.print("  "); // print character for pattern

                        System.out.println(); // move to next line of the pattern been printed

                        System.out.println();

                Tested for loop to print the following pattern goes below:
        //    # # # # # # # #
        //    #
        //    #
        //    # # # # # # # #
        //	  # # # # # # # #
        //    #
        //    #
        //    # # # # # # #


    }

    // Complete the code for the following method according to the project specifications.
    public static void printHorizontalBars()
    {
        Scanner sc = new Scanner(System.in);
        int num1 = 0; // number of times to print * on line 1
        int num2 = 0; // number of times to print * on line 2
        int num3 = 0; // number of times to print * on line 3
        int num4 = 0; // number of times to print * on line 4

        System.out.println("printHorizontalBars() method called....");

        // prompt user to enter four integers (selecting enter after each number)

        // read the numbers from the keyboard - remove comments tags to start
//       num1 = sc.nextInt();
//       num2 = sc.nextInt();
//       num3 = sc.nextInt();
//       num4 = sc.nextInt();

        // for loop to print out the number of *s for line 1

        // for loop to print out the number of *s for line 2

        // for loop to print out the number of *s for line 3

        // for loop to print out the number of *s for line 4


    }


    // Complete the code for the following method according to the project specifications.
    public static void printVerticalBars()
    {
        Scanner sc = new Scanner(System.in);
        int num1 = 0; // number of times to print * in column 1
        int num2 = 0; // number of times to print * in column 2
        int num3 = 0; // number of times to print * in column 3
        int num4 = 0; // number of times to print * in column 4

        // HINT: Printing to the console requires that you print from left to right starting
        // at the highest level and then moving from left to right...continuing to move from top
        // to bottom level of the pattern.  If you think of each column as a building, which building has
        // the most floors.
        //
        // For each building as you move from left to right...do you print ** or do you print two spaces.
        // You will need to print two spaces between each building to keep things manageable
        // You will also need to use a System.out.println() when you are finishing printing each
        // level.
        //
        // Since you are moving from the highest level to the lowest level, what is your for loop
        // going to look like.  You will need one for loop with four (4) if-else statements (one for each building)
        // inside the loop to help make the decision as to whether you will need to print the pattern
        // or spaces.
        //
        // When your loop has ended, you will then need to print a row of dashes at the bottom
        // of the pattern.

        int max = -1; // max number of *'s to print in any column

        System.out.println("printVerticalBars() method called....");

        // prompt user to enter four integers (selecting enter after each number)
        System.out.println();
        // read the numbers from the keyboard - remove comment tags to start
//       num1 = sc.nextInt();
//       num2 = sc.nextInt();
//       num3 = sc.nextInt();
//       num4 = sc.nextInt();

        // find the max  of all inputs

        // for loop to print out the max number of levels
        // if-else statement for building 1
        // if-else statement for building 2
        // if-else statement for building 3
        // if-else statement for building 4
        // end loop

        // print row of dashes


    }

} fix this code line by line