Question: Write a program, which displays straight lines inside a rectangle from one side to a perpendicular side. The lines must be drawn in such a

Write a program, which displays straight lines inside a rectangle from one side to a perpendicular side. The lines must be drawn in such a way that both the starting points of the lines on one side and the ending points on the other side are equidistant along the sides. The size of the rectangle is 980 pixels width by 630 pixels height.

For full points: repeat the entire process by drawing a small copy of the border inside the blank space of the design.

Code I have so far:

import java.awt.*; import java.applet.*; public class graphics extends Applet { public void paint(Graphics g) { int width = 980; int height = 630; //int x1 = 10; //int y1 = 640; //int x2 = 990; //int y2 = 640; int x1 = 990; int y1 = 10; int x2 = 490; int y2 = 640; g.drawRect(10,10,width,height);

// the x1, x2, y1,y2 coordinates // add a for loop that increments for (int i = 0 ; i

// Draw bottom-left corner //loop will run 51 times //x increment or decrement by some number/50 //y increment or decrement by some number/50 // Draw top-right corner // Draw top-left corner } } }

Write a program, which displays straight lines inside a rectangle from one

Applet Viewer: Graphics Labo2v110.class plast Applet Viewer: Graphics Labo2v110.class plast

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!