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

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 13:30
To remove a header or footer from a document you can open the header and footer and manually delete the content true or false
Answers: 1
question
Computers and Technology, 22.06.2019 11:00
How does a policy manual an organization? a. it boost productivity. b. it create awareness in employees about the organization’s values. c. it employees achieve targets. d. it safeguards the organization from liabilities.
Answers: 1
question
Computers and Technology, 23.06.2019 00:00
How do we use the sumif formula (when dealing with different formats) ?
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
Barbara is interested in pursuing a career in the science and math pathway. which qualifications will her reach that goal? a.an advanced knowledge of physics and math b.an advanced knowledge of engineering and math c. an advanced knowledge of physics and robotics an d. advanced knowledge of machinery and math
Answers: 1
You know the right answer?
Write a program, which displays straight lines inside a rectangle from one side to a perpendicular s...
Questions
question
Mathematics, 24.11.2019 01:31
Questions on the website: 13722362