Java Record 1
Java Record 1
4-1132
Quadatfc Cquation Practical No or
Aim
tOYite Java
a
PAoqram 4hat PYints all YOOts Of Ouoctratie
equation a+bxtC O.
Algovlthm
Step Stat
steP Read abc
step 3 :initiaize de -Cb* B) -4* a*c)
Step 4
initialize
T blaa
Step
i m SqrtCd)/2*a
step
maginay irst YOut isY+i im,
Paint ootS ane
(2
Step root is-I im.
and o e Second
Step 13 Stop
Program
impoYt java. lang. *
imPort dava. util. *.,
tmPoYt dava. io, *
class RootS
double T
SCanner S= new Scanner CSystem. in)
System.out, Printin C Enter abc Values "),
double a= S. nertobuble C)
double b S. 0et double c)
double C S . nert Double c),
eise 1F Cd >o)
System.out. Print Ln C R
*
+):,=
elSe
double x -b CoXa) ,
double Y Math .Sqrt C-d) lC>Wa)
3
output
abiC Values
Enter
53
R -l.O
Ra-.5
1
Algorthm
Step START
Step 4
Set
ct =0
Step 5
Set
Unti l de=i
Step + +o SteP 8
Step 6 Repeat
hen PTint i
f ct = 2
SteP 9A
n=n+ L
Step D
St ep
ENDD
Step 12
Progyom Practical o o2
imPovt ava io.
impont dava loang. *
impoyt Java util *
ctass Prime
Count =0
for Cint d2, J<i jtt)
ifCi 3 -
- o)
Count +t2
3
Cont --O)
3
3
Out Puut
5,5,4, l1,13, I4t9, 23, 19, 31, 34, 4 43,41153 59,6l,61 Hl13, 983,89n4
ADITYA DEGREE cOLLEGE
Algovithm
Step 1 Start
de fined
SteP 2 import required System Packoqes
Step 3 :Create a clasS Student with Yno, nome moTKS.deportmed
Method
: Crepte obTect for class student
Step
Step D stop
De15-
Praccal
Progroro
irmport Jovo tong *
irnport javo. io. *
class student
int roo,
String mome
double morkS
String dePortnerty
void displayc
ctoss Studentpemo
Sheastenent JAVA
display C
3
Output
Roll nlumber O
Nome Povan
markS 99.9
DRoatrmnt JAVA
DEPARTMENT OF COMPUTE
ADITYA DEGREE cOLLEGE
ate 383 32
HieraYchial nheitance
Aim tOYite Javo PRogYom to implemert
Hierarchia
Tobeyitance
Algorithm
Step StaYt
eat ing
step y elose +he method of Parert class
Date 38 3-3
Practical to oly
Program
import Java.io.*
imPoYt Java.util. *
ctass animal
void eat C)
Void bark C)
C
System.out. Println baTKinga e
void meow c)
DEPARTMENT OF COMPUTER SC
ADITYA DEGREE cOLLEGE Page No. 10
Date a8a-22
Practical No. ou
Output
barking
meouoing
eating
OF C O M P U T E R SCIENCE
DEPARTMENT
ADITYA DEGREE COLLEGE Page No
DiateG-o1 a3
MUItiple Inherttanc Practical tio o5
Aim OYite a Java
Proqram to implemernt muttiple nheritonce
through inter face
Atgoritm
Step Start
object S
efine a method display ExternalS C) and Print
Step 9
+he values of maolkS Placed in m and m2
eefine an iter face inteYnalS and dectare the
Step 1p
Nanlabte i'm and assign he Vclue 20.
step: APply he
Concept of
Multiple Inheritance
to derive ne class the name ReSults o o the
ctass Exteynats and Inter face InternalS.
Value
efine main C) mcthod clasS MuttipleInheritance
Step l5
Step 1t Stop
DEPARTMENT OF COMPUTER SC
ADITYA DEGREE cOLLEGE
Pvoqvam
irnpovt iova io. *,
import Java. lang.*
impoYt dava.util.4
ctass tudent
ectendS Student
ctoss Externals
flood mi,m2)
void gct Marks C
bf too Subiccts ),
Astem out. Println (Enter
manks
m S.next Floot C) )
n e c t Floot C)
m2 S
3
/Oid displayExtemals C)
COMPUTER SCIEM
DEPARTMENT OF
ADITYA DrGREE CoLLEGE
void isplaytntevnais c)
tat toto
fublic void displayantenals C)
tim)
System.cut.Pintko c Tntevnals
display Rounot)
display ENtemalsC)
display Dnternals c)
System.out. Print In C" )
System.out. Pvintln CTOtal :total)
ww
ADITYA DEGREE cOLLEGE
ge No 15
A Date &-ol-33
Practical io s
class Multiple Ioberitoance
Out Put
Enter roll number : oy
Enter marks OtwO SubiectS 85 32
Rou Number y
Subiect -l 5.0b
Subject - 2 396
Internals
Total 45 0
Algorithm
Step Start
Aogrom
impovt iavatan. *
import iava. io. *,
ctass String Demo
Str 2 Strl.
toupperCaSe c)
System olt. Printin C' Given String +Strl+ tn Capital lelteYS S:
Str ANIMATION +St2
Str2 Strt to LoweY COsec),
System.out Print Ln C" Given String"+ StY t i n Small letters
is."+ Ser
strl- animation
Str2 Strl.replace Ca', 'A):,
System.out Pr int In C After replocing a woith A "+Str2)
intl StYI.length C°
System.out. Printin Chength ot ven stving"+Strl+ is: "t),
tf CStrl .equalsLstr2)
SHStem. out aint RoC Gien tuoo Stris are equal ")',
etsc
SCIENCE
DEPARTMENT OF COMPUTER
ADITYA DEGREE COLLEGE
AnMAN Page No. 18
Date 95-ol 23
Practioal No 6
Output
Civen Stvimg animation in
Capltal tellevs is
NtT mATtONN
Civen Stving ANIMATTON n
Sall lettevs ist
Aftev
veplacin9 animatlon
A-AnimAtlon
ength of gven
seving-onimation is
:9
Given Stvimg ave not
cqual
integer
OF COMPUTER SCIENCE
DEPARTMENT
ADITYA DEGREE cOLLEGE P Poge No 2o
Dwe -0pa 33
Practal os
Step 9 Define main C) method c (ass Even Ddd and
define Ohiect Ho SCanneY ctass S
Step Stop
Poranm
imPort Java. lo.
import dava lang. *
class Even extend
S Threadd
int X
Even Cint n)
3
class Odd etends hwead
int
Odd Cint n)
Public Void u n t)
COMPUTER SCIEM
DEPARTMENT OF
ADITYA DEGREE COLLEGE Page No pa
Date 2-D2-93
Practical No 07
elassEvenodd
e.Start )
O Start )
Output
2y/6, 8 lD, 12, l6, 18,9 , 1, 35, 79,11 13, 1S, 14, 19
Step Stavt
Step hoose he namee of he PoCKage
Pile
Packaqe
SAcp 6 Stop
COMPUTER SCIE
DEPARTMENT OF
ADITYA DEGREE COLLEGE
3-43
Program
Package P
COMPUTER SCIEM
DEPARTMENT OF
ADITYA DEGREE COLLEGE
Ote 3 3
Packagc CCotection) Practeel o o
lgovi4ho
Shared dibrony.
Create
SteP 5
Run he Paoqram.
Step
DEPARTMENT OF COMPUTER