0% found this document useful (0 votes)
11 views14 pages

Java Programming Exercises

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)
11 views14 pages

Java Programming Exercises

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

JAVAeMMNG

[Link]
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 [Link] linstcadlfnc z
ulLcpaTu Tu (inucalLinc_
[Link] ("Eater d to add, 2 to euhktuaud
3 ta pueduul2 ;
chaice=Tntegeu pauseZnt (fnuealhia
);
itch lhace

Case

[Link]-psintln (1he kum o two nok


+Sum)

cia-b
[Link] dilaunu aea nALmbas
haeak;
Lase 3

Sustem cul puitlnTh nAcdutawDumbes


is"psd)
pueak
dhaulk: (Luong_ckalee3
3uys [Link] 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

[Link].
publi lass Tulangle
als

oLthli osk stati vcid main Stednq


aug) tlaucws
P

JOExcupetisn
int [Link] choke
elaubleueas
TnputRiucomReadeu uad nee TputKteucamlcadeu
Bll euedReadeu h [Link]);
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 ([Link] i)
a1ed Mah:Sqat )*i|4ata,
9yslem out paidla ["Aauea ol £quilateual TZuhaglaton
bieak
case 2:
Syslem-outpalintin Tsosreles Tuiangle
[Link]-pahatin Enteu the base ide
ufang):
he Tdegpae Intnodlina a-
a Tnteon panAeIni linuLOLine U
auea b1|41 [Link] (4ihlb-afa);
[Link]-paintln Auea a sosxela Tulargle =on
buoa
YE PASt N

CaAe 8:
Sstem-oukpuiiath Scalone lauargle;
[Link]-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);

[Link]- painth Auea Scalo eangle--tQuea


bueak
dyaull
[Link] 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_
[Link] (entu tharce nunkea);_
a TakegeL2aueTnt in ueadlin :
b latgpruselit (inaie0dkine c)):
L Tategem-paue It_in-seudlie } -

[Link]"The mallest Dunbe ista

Syslein-oulpuíallnlhe Sualles!Dumbeu is1bi


Syskem-oud-paillnhe knallesk numheu is"ac
[Link] ("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
[Link] pulata ("Enteu thue nunhes;

i a>hl&RLa>)

[Link]-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;


[Link]-paintahe second guatet no iltbl
The [Link] uiiketeuk uelged [Link]
to allcwing CAilteud
aveuag ns 2=t0 and avenage wrkrts taken[Link] 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 [Link])
int , d
8ustem-outspuiiln (Enkeu aveuage sns a Lutkete-
i n nest]nt );
gyghem-out peintin (Éntey _aveuageoirketk taken
[Link] a uitkehr-
(a=40 EL(o3)
[Link]-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
[Link] )
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 [Link] 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)
[Link] Roqat Argled soscelexsuangle_
&Rlghigled at B
erca-abi
[Link]("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 [Link]-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
[Link] (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:
[Link] puintln Entu tempezalun in lrlhi
t TnlegeupayeTntLinseadlhe)
Ik9C/5t32
t 243
[Link] ("h tapinakunie
Sstmcul idla b lyin fs
ep iekelin is

Lase
[Link] "eku impeualusa ia fa
TnkegaupsuuLlat lin uadlire 1 :
kCt213
[Link] pucth he lenp in thiu is):
[Link] pairtlnTe tenp in Eekin istk
bueak

[Link]-pithlnEnteu tnpeuataein keluin).


K: Tatrgeu paueInt (in aicadkint)l;
C k-21
gte/533
[Link] 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
([Link]);

BulleudReadeu in new BulaurdKcadtsurd-


[Link] puiln(Ente da -fhuuu diail nurba,
n [Link] [Link] L:

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

[Link] 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 [Link] "ente many dpegit
m Inkegeu paute Iyrt (nueadlint ;
[Link] 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 [Link] meney_deposited- R hn
[Link] Valu e Rs. "tntv

You might also like