0% found this document useful (0 votes)
9 views

Java Programs

Java programs for practice(11th adn 12th ISC)

Uploaded by

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

Java Programs

Java programs for practice(11th adn 12th ISC)

Uploaded by

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

JAVAeMMNG

0.Akuile
htile aAutaant ddva toind a um,
lleuene ueclutt twa nitns a
Lueu chelces
inyeet fant:e.
piblicclat Mendu
gpuelde statie vaidnaiSLuicy aysl) Theaus
TOExCer hon

Sat ob.c,aun,dilfPalod.,cluaict;
lputSLaCanLReadeL Lecneo LpylSlauecunmReacler
(tem ?n);_
dleutdkeadtulo ne Bulkeuwolkeoalu_utod);
Systenm od paiutIn (Enleu twe numes3 -
a nttga.pauTat linstcadlfnc z
ulLcpaTu Tu (inucalLinc_
Sustmu.eudpuintln ("Eater d to add, 2 to euhktuaud
3 ta pueduul2 ;
chaice=Tntegeu pauseZnt (fnuealhia
);
itch lhace

Case

System.eud-psintln (1he kum o two nok


+Sum)

cia-b
Suttm.culLpufathhe dilaunu aea nALmbas
haeak;
Lase 3

Sustem cul puitlnTh nAcdutawDumbes


is"psd)
pueak
dhaulk: (Luong_ckalee3
3uys tzm.at priath

2)ufh a 2uegaam to calulate the auaa


eguilatwalsacala anolBcalaune thuiangle aLtandiag-
t the Aeu'sahoice

ocgullaral laargte 4
Hint: AueaTsosceles fa
taulangle-14T,1AB-at
Luea
Auga a Scalee teuandpsi4-f%-66-0
hIhesess- a+btcl/2 ana a,b,c aue la leys
luseeaidu th tudangle

inpostlava.io.
publi lass Tulangle
als

oLthli osk stati vcid main Stednq


aug) tlaucws
P

JOExcupetisn
int b.cs choke
elaubleueas
TnputRiucomReadeu uad nee TputKteucamlcadeu
Bll euedReadeu h Eystem.in);
n BLleuedkeadeu urad;
4ystem-out puintln_Enleu Jau Eqailalmal,2
au esceles 3fau Lalknu
ehoiceTnicgu pause Tat Lio-ueadlinejO):_
&wilkh (choee

Syskerm aut cpuintin (Equilateual Zulanle


08usfemout quintla Enleu-h gidea Haianl
a TategeLpase Tnt (in.ucadlfng i)
a1ed Mah:Sqat )*i|4ata,
9yslem out paidla ["Aauea ol £quilateual TZuhaglaton
bieak
case 2:
Syslem-outpalintin Tsosreles Tuiangle
skem.cut-pahatin Enteu the base ide
ufang):
he Tdegpae Intnodlina a-
a Tnteon panAeIni linuLOLine U
auea b1|41 Math.sqat (4ihlb-afa);
System.ou-paintln Auea a sosxela Tulargle =on
buoa
YE PASt N

CaAe 8:
Sstem-oukpuiiath Scalone lauargle;
9ysktm.cut-puintln[Ënteu -thuee
ida s nel
n

w);
a Talegai paueInt (nsunadlinea
beJntegeupasue Ta. linsLcadine
C Taltau-auueTnt nueadihe ;
slarb/ 2:0;-
autaa Mathsqat stAla-)g-)Y3-d);

Sushem.nut- painth Auea Scalo eangle--tQuea


bueak
dyaull
usem.aut patalln NAerg Chai~ellL

h2aih
Wuih a dpuungLuam in Java tn_enteu lheLee.
aLee.
nok ay uio nput &tatementand dispa tho
o
maller he thuwee numbeu 7 tay due equd
then dsplay he mestpe AU Hhe nes

impoast javd int


2ubli clas Snallest

pabl
prabke stai void Man[Stuing augsll uans IOExcepian
fnt a,b,c
TnputStueamRead eu ead=_ne TnputStusamKeadey
System-in
BudReades in-nu Bulfuudkeacdu leLad_
yskem-auct.peiatla (entu tharce nunkea);_
a TakegeL2aueTnt in ueadlin :
b latgpruselit (inaie0dkine c)):
L Tategem-paue It_in-seudlie } -

Sqstaro.outpsiltln"The mallest Dunbe ista

Syslein-oulpuíallnlhe Sualles!Dumbeu is1bi


Syskem-oud-paillnhe knallesk numheu is"ac
8gkem-ou.spuitln ("ALthe nwmhtus au equal

Wuite a puagaam in ava ta ealu hE Uncqual


annumb os_ and lisplay h seLond guealat
rumheuamang he thueg numhera
Sample Thput Sanple Oudput
Enteu thuee numbea: 45,6132 The 2nd greatutnumho:45

impoujava ia.
Lpublic eless SetondGueateut
public statt vail main Shuiag auglhuases TEcpti

int ahc
ncc TnpiuttacamPead
nptshutanktadeu Ltad mReadeu
rttardkeahu a t R d t d femea Cstem. ,
audkeadeu in-neu Bulleudleacdeu laueaa
System.cut pulata ("Enteu thue nunhes;

i a>hl&RLa>)

Syslent.aut-píatin heseLtnd gaunatut na- A.


Sgstenaud pauntla "e SeLond gunlst ro ia'):

a>c)
8ys tem outpaintln (The seend gutatut no ic4al
elie
2System-autpuiatln "The sLendpuatat no ise;_
aso)kLA)

System autipuintln ("he second aueakust no ista;


Bystm.oud-paintahe second guatet no iltbl
The pug.csmarnce uiiketeuk uelged act.eltng
to allcwing CAilteud
aveuag ns 2=t0 and avenage wrkrts taken2:3: All
ayeuge 2UUR >= 60; Basman AGUndeu
i aveuaqe- unA=10 and aveuege kels_take
Bow leu elhe aeicketkeepeu aleldcu
eite a n_in Jara to atept no
made_and hoattek takenby a eedeteey
And diplay hi peufeumaue
Smpoud jaka-udtl, K_
uhlic claS i ket

puble shati ynitmaln Staigs augaL)


Seanneu n= new Scanceu syskem.in)
int , d
8ustem-outspuiiln (Enkeu aveuage sns a Lutkete-
i n nest]nt );
gyghem-out peintin (Éntey _aveuageoirketk taken
oin.nextInt a uitkehr-
(a=40 EL(o3)
Sygtem.out-peuintln ( Yau_aue an alluLLndeu;

Setem-out paitin_ au auea basman 2;


elke (uz-l04% (o> t)
Sustem-.0utzpuinth (NYau auea bauleu ;
else
System eud:paiatno_a e uicket kype eu4
Frelder"
FAGE

)A bak pa annoal inteuest tn theicutomera


ftum dlizosit szhemes s p thu airen
n tauis
fatai
fme Tale
Up ta 6manth 50
Maue than me atht anad p o 1 - 5-5 a
MO han 1y and p tndyu-
a than yu And p h 2
Me than yeau -0 h
i t e a ughamE inLaltulate mahutts
AMLunt aLLondhngk, inkingulinipa and ine

impoait jaa-uill.I
publii cdan Maluil4

pulh statt ved main (Stuirg ugs LL


Scaaitu inz iew Scanney yelonin
int ts
deukle psiz0;
Systmcubspuitla Entuu puizuipal
in.nextInt )
Syshn aut-prlatla énlu tim in manlk);
in netIt U
gi-lptstlJ12t1oo) ;_
si-lpt5.5tp/2tiao;
4

siptt)I2tiec
Lpts5t)L/2 tI0o);
i=ptrlZ(1210a);
Systen aut-puintlnThe întzueat eRsgi)
Sustmaud puitlnAThe amaiunt-Ri 2pisa)

dtana bstuen prids l s ) andLlz) i


Lyen ourula; AB =-
h2aib puEgam in Jaua a apt
to-audinelaathe Veutices a _ a iangle and
check_whethr i a euight Cgled itesek
teuargle e notThe puuegLam ay{o mebdles indicatta
tunle whthis uiaht_arrgled.
Sanple npuk Alo,0,EAss cess
Angle A=90*

imnad java:util.;
ublit las Cacudinate
cpublic slati vel malnLStuig auusL)
Sranneu n new Scanneu (18ustmial;
GE

Int si, 2,xi


stem-aut-puintln
n-cadinnkea),
"Entey L D-Cudihates).

x2in-nent Us
x3in nertInt U;-

in. noxt Tat U


3 ip.nextTnt U
ab {-x) x2-nl)_t2-y 2-qt
bc= k3-xx3-a2 (-y2)us-y2)
da =x3-xd23-ni y3-y u3-
(abth)= =ca)
4stem.cutepauintn Roqat Argled soscelexsuangle_
&Rlghigled at B
erca-abi
Sysem.ourpuitin("Rht fogled osredas
uanglo ipht fee angled et C);|

llcaab)bo)
Syskem-outaimln ghit hnglkd Iso-5telexs
Ttargle Rehd angled atA

9 a l a gseguan_in Jara a dtlay tu tenpeurkue.


Kelyin as peu he
1 lonmpeunluu_s ia , lhen dizplay la F&k.
tompeuatuue is in E, thca dipley in Ezk
Lenpeocrkuu h k, lhun dieplay in E& c

impput java.in-t
aublie_elass empetaluue

ubli slatle vaid main (3tauisg cugsL1)laauss


TCException
int chefc
doule c k
npudStLamkeade ead E no Tnput StLamleadeu
(Sys temin);
uad Peadeu in nu Bueucdkeade uracd,
V
3u8tem-out.paintIn (Enteu i kn empeuatuo n
Celsiu
8utem out puintin |'Ënteu2 udhon ttnpeuatuue in_
Fahuenked)
Sustem. oulpaintn enfew when tempcualue
kelvin ) ;
choice TntegeupauAe Tnt (Inucadkine O
Sitch (cheic

Case d:
Bstem.aut puintln Entu tempezalun in lrlhi
t TnlegeupayeTntLinseadlhe)
Ik9C/5t32
t 243
Sstam.ulsadh ("h tapinakunie
Sstmcul idla b lyin fs
ep iekelin is

Lase
Sstem.cutpuitla "eku impeualusa ia fa
TnkegaupsuuLlat lin uadlire 1 :
kCt213
Sstem.cul pucth he lenp in thiu is):
Systm.ed pairtlnTe tenp in Eekin istk
bueak

Syattm.eut-pithlnEnteu tnpeuataein keluin).


K: Tatrgeu paueInt (in aicadkint)l;
C k-21
gte/533
Qusttm.cut paictnhe temp in lulhiu "A)
Suskemaut puint heHomp. inaunil 24;
beeak
Syskam-aute paiatln(LOueng ckaicez

Dmbeuand nednelthSun the


Lst dliH_ad 1iud dg wig
Ipraudjava-i
ublic clas 2zik&
public stati reidain Slaioy rg e s 7CExcplia

iot n nin2, n3,


InpulStuearReadeused= e nputstLuecReadeu
(System.in);

BulleudReadeu in new BulaurdKcadtsurd-


Sysiem.cu puiln(Ente da -fhuuu diail nurba,
n Intgpu.paueTnt in.LLadhire L:

h n% J00
n3= h2 10
S nitnl
Systen-cutpuiuth ("lht u s ist
.
ar2
S
hid dak

n.dA man deposits 300 pe meadh n


1dA yadialh Part has.
manhs unde a Rerwuiu parit SEhezme hal uotu
he the_matuuity value hi depesisks, {hehaak
pay &1 g7 peu annum7
lt
Hint n= numbu ensell onthi, MI= MonihlyZrutallmnt
Pe Mt(nthri 7 - / 2 gru Znteedpt'T
Matuwity Yaluna MTtALJnteu
DATE tAGE

in Java 0pELd@k e
Keiheilha2uaana
MaAd monthl
a e tuk. Znke iapuuh a
dlpeslDumbeus mntht aned eLnl

ipoatjava-in.
publc class Reruwnuirg
publio sali ynidmain_(Stauirg auga huus TOEx

fat m,tLn;
dauble , ,L,mr;
TapdStueankeade u0pd n yputhhuanReadeu
&ysem-inl;_
uleedkeadeu in_neu BulleuedReacleu lead
Byskern Wyptom.autpeintin "ente many dpegit
m Inkegeu paute Iyrt (nueadlint ;
Systm.auh paintln "Enteu numaeu a_meaths;
n= Tregeu pauseIntin LeadLioe L
ustan-dud- paintin_(Enteu pa
-TategepaucTnt n-wedding O
ladnube gtu/ 1200-c0
mv mtn)+si
uatemout puintln_Tnteveat Rs. 4si
jsttm-aut paintln.Ttad meney_deposited- R hn
System.autpuiatln.Makuoits Valu e Rs. "tntv

You might also like