Homework Solution: JAVA Assignment…

    JAVA Assignment Use JCreator to solve Pattern 1 * ** *** **** ***** ****** Pattern 2 ****** ***** **** *** ** * Pattern 3 ****** ***** ****    ***     **      * Pattern 4      *     **    *** **** ***** ****** using 2 loops 4 different directions nested loops 4 seperate programs

    Expert Answer

     
    import java.util.*; import java.lang.*;

    JAVA Assignment

    Use JCreator to solve

    Archetype 1

    *

    **

    ***

    ****

    *****

    ******

    Archetype 2

    ******

    *****

    ****

    ***

    **

    *

    Archetype 3

    ******

    *****

    ****

       ***

        **

         *

    Archetype 4

         *

        **

       ***

    ****

    *****

    ******

    using 2 loops 4 divergent directions

    nested loops

    4 seperate programs

    Expert Apology

     

    import java.util.*;

    import java.lang.*;

    import java.io.*;

    /* Name of the tabulate has to be “Main” barely if the tabulate is social. */

    tabulate Ideone

    {

    social static null archetype1(int n) { // Function to counterfeit archetype 1, Here n implied compute of degrees in archetype

    int k =1,i,j;

    System.out.println(“Archetype 1 : “);

    for ( i =0; i < n; i++, k++) { // Quencheder loop accomplish fly from 0 to n, where n is compute of degrees

    for ( j = 0; j <k; j++) // Here, k is indicating compute of “*” to sculpture, we accept to increment it as we go to degree 2, 3 .. 6

    System.out.print(“*”);

    System.out.println();

    }

    }

    social static null archetype2(int n) {// Function to counterfeit archetype 2, Here n implied compute of degrees in archetype

    int k =n,i,j;

    System.out.println(“Archetype 2 : “);

    for ( i =0; i < n; i++, k–) {  // Quencheder loop accomplish fly from 0 to n, where n is compute of degrees

    for ( j = 0; j <k; j++) // Here, k is indicating compute of “*” to sculpture, we accept to adulteration it as we go to degree 2, 3 .. 6

    System.out.print(“*”);

    System.out.println();

    }

    }

    social static null archetype3(int n) {// Function to counterfeit archetype 3, Here n implied compute of degrees in archetype

    int k = 0,i,j,p;

    System.out.println(“Archetype 3 : “);

    for ( i =0; i < n; i++, k++) {  // Quencheder loop accomplish fly from 0 to n, where n is compute of degrees

    for ( j = 0; j <k; j++ )// Here, primitive sculpture quenched ” “, primitive degree has 0 measure, then increment k as we propose to degree 2,3 …6

    System.out.print(” “);

    for ( j = 0; j <n-k; j++)

    System.out.print(“* “); //Here sculptureing “* ”

    System.out.println();

    }

    }

    social static null archetype4(int n) {// Function to counterfeit archetype 4, Here n implied compute of degrees in archetype

    int k = n-1,i,j,p;

    System.out.println(“Archetype 4 : “);

    for ( i =0; i < n; i++, k–) { // Quencheder loop accomplish fly from 0 to n, where n is compute of degrees

    for ( j = 0; j <k; j++ ) // Here, primitive sculpture quenched ” “, primitive degree has n-1 measure, then adulteration k as we propose to degree 2,3 …6

    System.out.print(” “);

    for ( j = 0; j <n-k; j++)

    System.out.print(“* “);  //Here sculptureing “* ”

    System.out.println();

    }

    }

    social static null deep (String[] args) throws java.lang.Exception

    {

    pattern1(6);

    pattern2(6);

    pattern3(6);

    pattern4(6);

    }

    }

    Sample Quenchedput :

    Archetype 1 : 
    *
    **
    ***
    ****
    *****
    ******
    Archetype 2 : 
    ******
    *****
    ****
    ***
    **
    *
    Archetype 3 : 
    * * * * * * 
     * * * * * 
      * * * * 
       * * * 
        * * 
         * 
    Archetype 4 : 
         * 
        * * 
       * * * 
      * * * * 
     * * * * * 
    * * * * * *