Question: Q 4 ) Complete the following ( Java ) method to draw the following shape: void draw ( int x , int y , int

Q4) Complete the following (Java) method to draw the following shape:
void draw (int x, int y, int w, int h, Graphics g ){
int x1, x2, x3, y1, y2, r, xLeft, yLeft; // Calculation in terms of x , y, w, h
g.drawRect(x-w, y, w, h);
x1=(int)(Math.round( x+__________)) ;
x2=________;
x3=___________;
y1=__________;
y2=__________ ;
r =_________;
xLeft=_________;
yLeft=__________ ;
g.drawLine( x1, y1, x2, y1);
g.drawLine( x1, y1, x3, y2);
g.drawLine( x3, y2, x2, y1);
g.drawOval( xLeft, yLeft, 2*r ,2* r);
}
Q 4 ) Complete the following ( Java ) method to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!