LabApril21 - for(int cl = rw cl<= 18-rw cl b[rw[cl...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
import javax.swing.*; import java.util.*; public class LabApril21 { public static void main(String[] args){ //create array String a[][] = new String[10][20]; //Empty array for(int rw = 0; rw<a.length; rw++){ for(int cl = 0; cl<a[rw].length; cl++){ a[rw][cl] = " "; }} //For the top half of the figure for(int rw = 0; rw < a.length; rw++){ for(int cl = 9 - rw; cl <= 9 + rw; cl++){ a[rw][cl] = "*"; } } //Display Array for(int rw=0; rw<a.length; rw++){ for(int cl = 0; cl < a[rw].length; cl++){ System.out.print(a[rw][cl]); } System.out.println(); } //Second half of first array //============================================================== //create array String b[][] = new String[10][20]; //Empty array
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
for(int rw = 0; rw<b.length; rw++){ for(int cl = 0; cl<b[rw].length; cl++){ b[rw][cl] = " "; }} //For the bottom half of the figure for(int rw = 0; rw < a.length; rw++){
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: for(int cl = rw; cl <= 18-rw; cl++){ b[rw][cl] = "*"; } } //Display Array for(int rw=1; rw<b.length; rw++){ for(int cl = 0; cl < b[rw].length; cl++){ System.out.print(b[rw][cl]); } System.out.println(); } //=========================================== //Second Shape //=========================================== System.out.println("\n\n\n"); //create array String c = new String[10][20]; //Empty array for(int rw = 0; rw<c.length; rw++){ for(int cl = 0; cl<c[rw].length; cl++){ c[rw][cl] = " "; }} //For the top half of the figure for(int rw = 0; rw < c.length; rw++){ for(int cl = rw; cl <= rw; cl++){ c[rw][cl] = "*"; } } //Display Array for(int rw=0; rw<c.length; rw++){ for(int cl = 0; cl < c[rw].length; cl++){ System.out.print(c[rw][cl]); } System.out.println(); } } }...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern