Binder of the 3 rectangles from 6

Binder of the 3 rectangles from 6 - /* * Rectangle1.java *...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: /* * Rectangle1.java * * Created on Feb 1, 2004 * Updated on Apr 25, 2005 * * Author: Paolo Bucci * * This program outputs a rectangle of '+'s of width and height * provided by the user. (The whole program is in the main method.) * */ import java.util.Scanner; public class Rectangle1 { public static void main(String args) { Scanner keyboard = new Scanner(System.in); // Input the width of the rectangle System.out.print("Enter width > 0: "); int width = keyboard.nextInt(); // Input the height of the rectangle System.out.print("Enter height > 0: "); int height = keyboard.nextInt(); // Output height rows of width columns of '+'s int row = 0; while (row < height) { // Output one row of width '+'s int column = 0; while (column < width) { System.out.print('+'); column = column + 1; // go to the next column } System.out.println(); // terminate the row row = row + 1; // go to the next row } } } /* * Rectangle2.java * * Created on Feb 1, 2004 * Updated on Apr 25, 2005 * * Author: Paolo Bucci *...
View Full Document

Page1 / 5

Binder of the 3 rectangles from 6 - /* * Rectangle1.java *...

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