Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 } } }

image text in transcribed

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 1 Lnai 6321

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215879X, 978-3642158797

More Books

Students also viewed these Databases questions