JAVA Prog Ai ml04102023
JAVA Prog Ai ml04102023
Advanced Studies
Ex. No : 1
Date: 22-07-2021 Find area, perimeter of circle
Aim
ALGORITHM
START
INPUT RADIUS
DISPLAYAREA
PERIMETER
STOP
RESULT:
Thus the output has been verified for area and perimeter of a circle using
Ex. No: 2
Date : Substring removal from String
AIM
ALGORITHM
START
INPUT STRING1
string1.Length ()
INPUT STRING2
START-INDEX=STRING1.INDEX OF (STRING1)
PRINT STRING
STOP
RESULT:
Thus the output has been verified for remove a substring from a String
Ex. No: 3
Date :
Random Number Generation
AIM
To write a program for Determining the order of numbers
ALGORITHM
START
for(I=0;I<10;I++)
print a[i]
NEXT I
FOR(I=0;I<10;I++)
for(I=0;I<10;I++)
for(J=0;J<10;J++)
Yes No
IF(A[I]>=A[J]
S=A[I]
A(I)=A(I+1)
A(I+1)=S
NEXT I,J
FOR(I=0;I<10;I++)
PRTINTa[i]
NEXT I
STOP
RESULT:
Thus the output has been verified for Determining the order of numbers
Ex. No: 4
Date :
Implementation of Point Class
AIM
To write a program for Implementing of Point Class.
ALGORITHM
Step3: Get Row, Column Displacement points p1, p2 using Point class
Step4: If p1.X and p2.X are equal and p1.Y and p2.Y are equal print it is
Invalid Coordinates
Step7: If p1.X and p1.Y are equal print it is Square else print Rectangle
START
Declare x,y,x1,y1,s
YES If(p.getx()==p1.getx()&
&p.gety()=p1.gety())
Print
Invalid Coordinate NO
YES If(p.gety()==p1.getx())
Print vertical
line
NO
YES if(p.gety()==p1.gety())
Print
horizontal NO
line
if(p1.getx()==p1.gety())
NO
YES
Print square Print rectangle
STOP
RESULT
Thus the different image manipulations are done successfully using
Point Class.
Ex. No: 5
Date : Usage of Calendar class
AIM
To write a program for finding current year is leap or not, using
Calendar class.
ALGORITHM
Step4: Check whether the current year is leap year or not and print it
START
STRING MATH[]={INT
YEARS}
GREGORIANCALENDAR GCALENDAR=NEW
GREGORIANCALENDAR
PRINT
(“DATE”+CALENDAR.MONTH
)
CALENDAR.DATE
CALENDAR.YEAR
IF YES
NO
GCALENDAR .ISLEA
PYEAR(YEAR)
STOP
RESULT
Thus the given date of year is checked whether it is Leap or not,
Ex.No: 6
Date : String manipulation using char Array
AIM
Algorithm:
START
INPUT
STRINGH
L=STRING.LENGT
FOR(I=L-1,J=0;J>=0;I--,J++)
R[J]=C[J]
PRTINTR[J]
NEXT I
FOR(I<0;I<=L-1;I++)
Yes NO
F=1 IF F=0
R[J]=C[J]
BREAK
NEXT I
STOP
RESULT:
Thus the output has been verified for manipulating String by finding
Ex.No: 7
Date Working with Panel and Layout
A IM
ALGORITHM
START
STOP
RESULT
The panel and its different layout along with different components
Ex.No: 8
Date : Usage of Vector class
AIM
Algorithm:
START
VECTOR=NEW VECTOR ()
PRINT V.SIZE ()
ENUMERATION = V.ELEMENT ()
WHILE
No
E . HAS MORE
ELEMENTS ()
Yes
PRINT
E.NEXT3ELEMENT
STOP
RESULT:
Thus the output has been verified for implement usage of vector class
AIM
To write a program for implement Thread based Applications and
Exception Handling.
ALGORITHM
START
STRINGNAME
STRING LIST[]={}
THREAD1.START
THREAD2.START
FOR(INT I=0;I<LIST.LENGTH();I++)
PRINT(NAME+LIST(1))
THREAD.SLEEP()
THREAD.SLEEP()
NEXT I
STOP
RESULT
Thus the output has been verified for Thread based application &
Exception handling.
Ex. No: 10
Date : Working with Menus
A IM
ALGORITHM
Step2: create menu bar, menu, menu item and text area.
START
Init()
ActionPerformed()
Class menucreation()extends
Frame
Menucreation()
STOP
RESULT
The Menu items are worked successfully using Applet.
awt controls.
Ex. No: 11
Date : Incorporating Graphics
A IM
To write a program creating various shapes using graphical
statements.
ALGORITHM
Step2: create oval, rectangle, square and circle using their graphical statements
START
void init()
void paint(Graphics g)
g.drawRect(100,20,50,50);
g.fillRoundRect(200,20,80,50,50,60);
g.drawOval(20,100,50,80);
g.fillOval(100,130,50,50);
g.drawPolygon(x,y,n);
g.fillPolygon(a,b,n);
STOP
RESULT:
Thus the output has been verified for drawing various shapes using
graphical statements in the applet.
Ex. No. 12
Date : Working with Font and Color
AIM
To display various fonts and its style in different colors.
ALGORITHM
Step3: set the font type and set the font size
START
Font f;
String s;
Void paint()
setBackground(Color.pink);
g.setColor(Color.magenta);
f=new Font("Arial",Font.PLAIN,25);
g.setFont(f);
g.drawString("VELSUNIVERSITY-VISTAS",10,50);
STOP
RESULT
Thus the output has been verified for various colors and fonts
using AWT controls.