Code:
import
java.awt.*;
import
java.applet.*;
import
java.math.*;
public
class Trans extends Applet
{
public
void paint(Graphics g)
{
g.drawLine(100,150,100,250);
g.drawLine(100,150,250,250);
g.drawLine(100,250,250,250);
int
a[][]=new int[3][3];
int
b[][]=new int[3][3];
int
c[][]=new int[3][3];
int
i,j,k;
a[0][0]=1;
a[0][1]=0;
a[0][2]=100;
a[1][0]=0;
a[1][1]=1;
a[1][2]=100;
a[2][0]=0;
a[2][1]=0;
a[2][2]=1;
b[0][0]=100;
b[0][1]=100;
b[0][2]=250;
b[1][0]=150;
b[1][1]=250;
b[1][2]=250;
b[2][0]=1;
b[2][1]=1;
b[2][2]=1;
for(i=0;i<3;i++)
for(j=0;j<3;j++)
{
c[i][j]=0;
for(k=0;k<3;k++)
{
c[i][j]=(c[i][j]+(a[i][k]*b[k][j]));
}
System.out.println();
}
g.drawLine(c[0][0],c[1][0],c[0][1],c[1][1]);
g.drawLine(c[0][1],c[1][1],c[0][2],c[1][2]);
g.drawLine(c[0][0],c[1][0],
c[0][2],c[1][2]);
}}
/*<applet
code="Trans.class" width="800" height="800">
</applet>*/
OUTPUT:
Need
the code??
No comments:
Post a Comment