Page 1

Android Application Development By Bilal Rabbani bilalrabbani1@live.com Assignment No. 4 (Applet in JAVA) Solution Due Date: Oct 26, 2013 Question: Make a new Java project in eclipse. Create a Class named MyClass then inherit the class with a parent class ‘Applet’. Your task is to write a method in JAVA for Applet which draws a 3D square on AppletViewer or Web Browser.

Method should look like this: public void draw3Dsquare(int x, int y, int z, int Area, Graphics g)

Call method in paint(Graphics g): public void paint(Graphics g) { MyClass obj = new MyClass(); obj.draw3Dsquare(25, 25, 25, 10000, g); }

Output:

Hint:

[Finding the Square Root]

int height = (int) Math.sqrt(Area); ICT Trainings bilalrabbani1@live.com


Testing  
Read more
Read more
Similar to
Popular now
Just for you