Hello,
How can I draw the bottom left and right corner of this image? I'm able to draw them separately, but when putting them together the graphic is incorrect.
First program is the bottom left corner. Second for the bottom right.
https://imgur.com/a/1vtVM2A
import java.awt.*; import java.applet.*; public class Lab05v80 extends Applet { public void init() { setSize(1000, 650); // width, height } public void paint(Graphics g) { int width = 980; int height = 630; int x1 = 10; int y1 = 640; int x2 = 990; int y2 = 640; g.drawRect(10,10,width,height); for (int lines = 0; lines <= 50; lines++) { g.drawLine(x1,y1,x2,y2); y2 -= height/49; x1 += width/49; } } }This is the bottom left cornerimport java.awt.*; import java.applet.*; public class Lab05v80 extends Applet { public void init() { setSize(1000, 650); // width, height } public void paint(Graphics g) { int width = 980; int height = 630; int x1 = 10; int y1 = 640; int x2 = 990; int y2 = 640; g.drawRect(10,10,width,height); for (int lines = 0; lines <= 50; lines++) { g.drawLine(x1,y1,x2,y2); y2 -= height/49; x1 += width/49; } for (int line1 = 0; line1 <= 50; line1++) { g.drawLine(x2,y1,x1,y2); y2 -= height/49; x2 -= width/49; } } }
g.drawLine(x2,y1,x1,y2);
y2 -= height/49;
x2 -= width/49;
For the second for loop, is the indentation incorrect or the block structure?