subject

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 < height; i++)
{
g. drawLine(x1,y1,x2,y2);
x1 += width/ 50;
y2 -= height/ 50;

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

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

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:00, crimhill
When is it appropriate to use an absolute reference
Answers: 1
image
Computers and Technology, 23.06.2019 00:10, witerose701
Write a function so that the main0 code below can be replaced by the simpler code that calls function mphandminutes tomiles0. original main0 int main) l double milesperhour-70.0; double minutestraveled = 100.0; double hourstraveled; double milestraveled; hourstraveled = minutestraveled / 60.0; milestraveled = hourstraveled * milesperhour; cout < "miles" 2 using namespace std; 4 /* your solution goes here/ 6 int maino 1 test passed 7 double milesperhour 70.0 all tests passed 8 double minutestraveled 100.0; 10 cout < < "miles: " < < mphandminutestomiles(milesper-hour, minutestraveled) < < endl; 12 return 0; 13
Answers: 1
image
Computers and Technology, 23.06.2019 07:30, emilyplays474
What key should you press and hold to select and open multiple files at one time? enter alt control esc
Answers: 1
image
Computers and Technology, 24.06.2019 08:30, 5theth
Intellectual property rights are exclusive rights that protect both the created and the creation. ipr offers exclusively what benefits to the person or people covered by it
Answers: 3
You know the right answer?
Write a program, which displays straight lines inside a rectangle from one side to a perpendicular s...

Questions in other subjects:

Konu
Social Studies, 10.12.2021 21:00
Konu
Mathematics, 10.12.2021 21:00
Konu
Business, 10.12.2021 21:00
Konu
Mathematics, 10.12.2021 21:10