现在的位置: 首页 > 综合 > 正文

斯坦福大学开放课程——编程方法 作业2 – 1

2014年01月17日 ⁄ 综合 ⁄ 共 1543字 ⁄ 字号 评论关闭

 

1.

   Write a GraphicsProgram subclass that draws a pyramid consisting of bricks arranged in horizontal rows, so that the number of bricks in each row decreases by one as you move up the pyramid, as shown in the following sample run:

 

 

   The pyramid should be centered at the bottom of the window and should use constants for the following parameters:

BRICK_WIDTH            The width of each brick (30 pixels)

BRICK_HEIGHT           The height of each brick (12 pixels)

BRICKS_IN_BASE        The number of bricks in the base (14)

    The numbers in parentheses show the values for this diagram, but you must be ableto change those values in your program.

 

 

程序源代码:

 

抱歉!评论已关闭.