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, 22.06.2019 06:00
In outlook how can cherie look at the details of an event that appears on the month view of her calendar? check all that apply. by switching to the detail view by switching to the week view by switching to the day view by right-clicking on the event by double-clicking on the event by highlighting the event
Answers: 2
question
Computers and Technology, 22.06.2019 18:40
Mariah was working on a multimedia presentation that included both video and audio files. the file was huge, and she wanted to send it to her coworker in another office. she needed to reduce the size of the file so that it could be transmitted faster. the utility she used to do this was
Answers: 2
question
Computers and Technology, 22.06.2019 22:30
One of your customers wants you to build a personal server that he can use in his home. one of his concerns is making sure he has at least one backup of their data stored on the server in the event that a disk fails. you have decided to back up his data using raid. since this server is for personal use only, the customer wants to keep costs down. therefore, he would like to keep the number of drives to a minimum. which of the following raid systems would best meet the customer's specifications? a. raid 0 b. raid 1 c. raid 5 d. raid 10
Answers: 3
question
Computers and Technology, 23.06.2019 16:30
If i wanted to include a built-in calendar in a document, what option could i select? draw table insert table insert chart quick tables
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
Chemistry, 23.02.2021 14:00
question
Mathematics, 23.02.2021 14:00
question
Mathematics, 23.02.2021 14:00
question
Mathematics, 23.02.2021 14:00
question
English, 23.02.2021 14:00
question
French, 23.02.2021 14:00