shapes - return type public static void rectangle(int rows...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.Scanner; public class shapes { static Scanner keyboard = new Scanner(; public static void main(String[] args) { rectangle(4,6); square(5); triangle(6); } public static String shape() { System.out.println("What shape would you like to have drawn?"); String type = keyboard.nextLine();
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: return type; } public static void rectangle(int rows, int cols) { for(int i = 0, counter = 0; i < rows; i++) { System.out.println("*"); if(i > rows && counter < cols) counter++; i = 0; } } public static void square(int side) { } public static void triangle(int length) { } }...
View Full Document

This note was uploaded on 04/03/2010 for the course COMPSCI 600.107 taught by Professor Houlahan during the Spring '08 term at Johns Hopkins.

Ask a homework question - tutors are online