0% found this document useful (0 votes)
6 views5 pages

JPR30RIYANKA

Uploaded by

Priyanka Thadke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

JPR30RIYANKA

Uploaded by

Priyanka Thadke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Gramin Technical And Management Campus

Department Of Computer Engineering


Subject/code: JPR/22412
Name: Thadke Priyanka Batch: A Roll No: 85
Practical No:30
Aim:- Develop a program to draw following shapes , graphics and applets.

Aim : Demonstrate the use of basic applet, which includes different shapes like cone, cube.

Program Code:

import java.awt.*;

import java.applet.*;

public class Ap extends Applet

public void paint(Graphics g)

g.drawString("(a).Cylinder",10,110);

g.drawOval(10,10,50,10);

g.drawOval(10,80,50,10);

g.drawLine(10,15,10,85);

g.drawLine(60,15,60,85);

g.drawString("(b).Cube",95,110);

g.drawRect(80,10,50,50);
g.drawRect(95,25,50,50);

g.drawLine(80,10,95,25);

g.drawLine(130,10,145,25);

g.drawLine(80,60,95,75);

g.drawLine(130,60,145,75);

/*<applet code="Ap.class" width="200" height="200"></applet>*/

Output:

Exercise:-
Q.2) Develop a program to draw any 2 of the following shapes:
a. Cone b. Cylinder c. Cube

Program Code;
import java.awt.*;

import java.applet.*;

public class Ap extends Applet

public void paint(Graphics g)

g.drawString("(a).Cylinder",10,110);

g.drawOval(10,10,50,10);

g.drawOval(10,80,50,10);

g.drawLine(10,15,10,85);

g.drawLine(60,15,60,85);

g.setColor(Color.blue);

g.fillArc(100, 10, 120, 80, 0, 180);

g.drawLine(110, 50, 160, 150);

g.drawLine(210, 50, 160, 150);

/*<applet code="Ap.class" width="300" height="300"></applet>*/ Output:


Q.3)Develop a program to draw any one of the

a. Square Inside a circle b Circle inside a square

Program Code:

import java.awt.*;

import java.applet.*;

public class Ap extends Applet

public void paint(Graphics g)

g.drawString("(a). Square inside a Circle",120,110);

g.drawOval(180,10,80,80);

g.drawRect(192,22,55,55);

g.drawString("(b). Circle inside a Square",290,110);


g.drawOval(290,10,80,80);

g.drawRect(290,10,80,80);

/*<applet code="Ap.class" width="450" height="200"></applet>*/ Output:

You might also like