You are on page 1of 14

A

Project Report on

"Develop a Rainbow and House using java aaplet"


By
Punde Siddhi. (43)
Sahu Sarala. (46)
Shingote Ankit.(52)
Shirsath Nikita.(53)
Shripat Komal.(54)
Guided by

Mrs.S.B.Chavan

Department Of Computer Technology


Government Polytechnic,Ahmednagar
2019-2020

1
CERTIFICATE

This is to certify that the project entitled " Develop a Rainbow and
House using java aaplet “has been carried out been

1. Punde Siddhi(43)
2. Sahu Sarala(46)
3. Shingote Ankit(52)
4. Shirsath Nikita(53)
5. Shripat Komal(54)

Under my Guidance in partial different fulfilment of the diploma of


Computer Technology Government Polytechnic Ahmednagar during academic
year 2019-2020 to the best of knowledge and brie. This work has not seen
submitted elsewhere for the award of any other diploma.

GUIDE. H.O.D. PRINCIPAL


(Mrs.S.B.Chavan) (Mr.S.D.Mule) (Mr.M.S.Satarkar)

Index

2
Sr.No Topic Name Page No
1 Introduction 5
2 Aim of the project 5
3 Course outcomes 5
4 Actual procedure followed 6
5 Source code 8
6 Output of the code 11
7 Action plan 12
8 Skill development/learning of this 13
microproject
9 Conclusion 13
10 Reference 13

Acknowledgement
3
We take this opportunity to thank our guide Mrs.S.B.Chavan for placing this
idea in our mind and giving marvelous suggestions from the platform of this
project. We are pleased to take Opportunity to construct a project " Develop a
Rainbow and House using java aaplet” . The project title would not have
been completed without the valuable Guidance and encouragement of my
family and friends.

4
Develop a Rainbow and House using java aaplet

Introduction:
In this project we are going to design Rainbow and House using Java
Applet. In this, we import firstly Applet and Awt packages to run applet
program. In our project, the user defined class is extended from Applet class to
inherite all methods of Applet class. We have used Graphics class object in
paint() method as an argument to call drawLine() methods. We have used try
and catch block to handle the exception. In this we also uses the concept of
thread. To execute the thread, we have used Runnable Interface. To run applet
program we have to make html program using applet tag. To execute applet
program we will use Applet viewer tool as " Appletviewer program_name.
java".

2. AIM OF THE MICROPROJECT


To design Rainbow and House using the concepts in the Java Applet. We
have used graphics class to make the project user friendly. We have
handled exceptions to execute the program successfully

3. COURSE OUTCOMES INTEGRATED


 Develop programs using Object Oriented methodology in Java.
 Apply concept of Inheritance for code reusability.
 Develop programs using Multithreading.
 Implement Exception Handling.
 Develop programs using graphics and applet.

4. ACTUAL PROCEDURE FOLLOWED


Related theory :

5
In this project ,we design Rainbow and House using java Applet
and Graphics Programming. we include Exception handling and
Multithreading,Inheritance functions. The console based applications are not
user friendly to handle for the end user by cause lack of Graphics.
In this project, Firstly we import 2 types packages. java.applet,it contain
classes for creating Applet and java.awt for the paint() method and it contains
Graphics class object.
Then we create a class Rainbow which is extend from Applet class.We started
class name with public keyword because we use all the method of Applet class.
Then we declare slep() method. In sleep() method we write try and catch block.
In try block wecall the tread class sleep() metho. It causes currently thread stop
excuting for 1000 milisec(1sec).
Then we declare Applet class init() method. This method used to initialize the
Applet. Then in we declare Graphics class paint() method the actual code is
present in this method. We create g object of Graphics class to call the Graphics
class methods.
By using g object we call the drawArc() method to draw a Arc for Rainbow. For
Rainbow we RGB colour value. For rainbow 7 colures we use for loop. In for
loop we call sleep() method for delay 1sec.
The for loop is end, complete Rainbow is display. For display a house we use
different Graphics class methods like drawRect() method for draw a rectangle.
drawPolygon() method for draw a polygon. We use drawPolygon() method for
draw a triangle.
We use setcolor() method to set the color of House and Rainbow. We call the
this .ethod using object g.We use Font class fr display a message.
To excute this Applet code we have used Applet tag in the command section in
our project. This command section is read by the Appletviewer tool not by the
compiler
To compile the program. :- javac rainbow.java

To run the program. :- Appletviewer rainbow.java

Resources Required :
6
Sr. No. Resources Specification Quantity
Used

1 Hardware Intel dual core,i3 1


Ram : 2GB Hard
disk : 80GB

2 Operating Windows 10 1
System

3 Software JDK 1
1.8.0,Notepad,
Command Prompt,

5.Program code:

7
import java.applet.*;
import java.awt.*

/*<applet code="rainbow" height=800 width=700>


</applet> */

public class rainbow extends Applet


{
void sleep() //for delay
{
try
{
Thread.sleep(1000);
}
catch(InterruptedException ex)
{
Thread.currentThread().interrupt();
}
}
public void init()
{
}
public void paint(Graphics g)
{

int x,y,z;
x=0;y=50;z=100;

8
for(int i=0;i<7;i++)
{
Color c1=new Color(z,x,y);
x=(x+50)%255;
y=(y+70)%255;
z=(z+100)%255;
g.setColor(c1);
g.fillArc(50+(i*20),20+(i*20),600-(i*40),600-(i*40),0,180);

sleep();
}
Font home=new Font ("Century Gothic",Font.BOLD,28);
g.setFont(home);
g.drawString("H O U S E",20,80);
int a[]={150,300,225};
int b[]={150,150,25};
int c[]={ 225,300,550,475};
int d[]={ 25,150,150,25};
g.setColor(Color.red);
g.fillRect(150,150,150,200);

g.setColor(Color.green);
g.fillRect(190,220,70,130);
g.setColor(Color.red);
g.fillPolygon(a,b,3);

g.setColor(Color.yellow);
g.fillOval(200,75,50,50);
9
Font dell=new Font("Century Gothic",Font.BOLD,20);
g.setFont(dell);

g.setColor(Color.red);
g.drawString("DELL",204,100);

g.setColor(Color.red);
g.fillRect(300,150,250,200);

g.setColor(Color.black);
g.fillRect(390,210,80,80);
g.drawLine(150,150,300,150);
g.drawLine(300,150,300,350);
g.drawLine(150,150,150,350);

g.setColor(Color.black);
int e[]={ 190,240,240,190};
int f[]={ 220,240,330,350};
g.fillPolygon(e,f,4);
g.setColor(Color.blue);
g.drawLine(430,210,430,290);

g.setColor(Color.yellow);
g.fillPolygon(c,d,4);

10
6.Output of the Code:

7. Action plan

Sr. Details of Plan Start Plan End Name of


no. Activity Date Date responsible
member
1 Topic Selection 26/12/2019 28/12/2019 Shirsath Nikita
Shripat Komal
2 Project Subject 28/12/2019 29/12/2019 Punde Siddhi Sahu
Finalization Sarala
3 Searching 10/01/2020 17/01/2020 Shingote Ankit
Information
Sahu Sarala
4 Coding Program 20/01/2020 10/02/2020 Shirsath Nikita
Shingote Ankit
5 Report 17/02/2020 09/03/2020 Shirpat Komal
Preparation
Shirsath Nikita
6 Submission of 12/03/2020 18/03/2020 Punde Siddhi Sahu
Project Report Sarala Shingote
Ankit Shirsath 11
Nikita Shripat
Komal
8. Skill Developed :
 Understanding the life cycle of Applet and Thread.
 Importing applet and awt package to use Applet and Graphics class
respectively in our project.
 Using the methods of Graphics class to draw various shapes.
 Extending Applet class to inherite its methods.
 Handling the exceptions for successful execution of program.

9. Conclusion :
This project is useful to display the design of Rainbow and House. In
this, we have used try, catch block to handle exception, so the program will
execute successfully. We have used thread concept by increasing rainbow
design of home.

10. References :
https://www.javapoint.com/
https://www.wikipedia. org
https://youtube. com

12
13
14

You might also like