LabApril21 - for(int cl = rw; cl <= 18-rw; cl++){...

Info iconThis 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
Background image of page 1

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

View Full DocumentRight 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++){
Background image of page 2
Background 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

This note was uploaded on 05/01/2008 for the course ECE 172 taught by Professor Olabe during the Spring '08 term at Christian Brothers.

Page1 / 3

LabApril21 - for(int cl = rw; cl <= 18-rw; cl++){...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online