1) The following program draws a simple bridge with two equally spaced supports.

import objectdraw.*;

import java.awt.*;

public class BuildBridge extends WindowController

{

protected void begin()

{

//Instructions to construct the road

new FilledRect( 50, 50, 300, 30, canvas);

new FramedRect( 118, 80, 50, 100, canvas);

new FramedRect( 236, 80, 50, 100, canvas);

} // end begin

} // end BuildBridge

a) Draw a picture of the simple bridge generated by the program.

b) How would you modify the code if the width of the supports changed to 70?

c) How would you modify the code if the upper, left-most corner of the bridge moved to (30, 30)?

d) Complete the coordinates for supports derived from the previous constant specifications.

import objectdraw.*;

import java.awt.*;

public class BuildBridge extends WindowController {

// Specifications that control road's shape

// Coordinates of road's corner

private static final int ROAD_LEFT = 50;

private static final int ROAD_TOP = 50;

// Dimensions of road

private static final int ROAD_LENGTH = 300;

private static final int ROAD_HEIGHT = 30;

// Dimensions of supports

private static final int SUPPORT_WIDTH = 50;

private static final int SUPPORT_HEIGHT = 100;

// Coordinates for supports derived from specifications

private static final int SUPPORT_TOP =

private static final int SUPPORT_SPACING =

private static final int LEFT_SUPPORTS_LEFT =

private static final int RIGHT_SUPPORTS_LEFT =

protected void begin() {

//Instructions to construct the road

new FilledRect( ROAD_LEFT, ROAD_TOP, ROAD_LENGTH, ROAD_HEIGHT, canvas);

new FramedRect( LEFT_SUPPORTS_LEFT, SUPPORT_TOP, SUPPORT_WIDTH,

SUPPORT_HEIGHT, canvas);

new FramedRect( RIGHT_SUPPORTS_LEFT, SUPPORT_TOP, SUPPORT_WIDTH,

SUPPORT_HEIGHT, canvas);

} // end begin

} // end BuildBridge