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

Java programs for practice

Mainly for 11th and 12th ISC students

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)
8 views

Java programs for practice

Mainly for 11th and 12th ISC students

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/ 15

Tuesday

R|08122DATTE AVA PACE No

aLogua. eilea
t0_OLS1gDhe ro0 pumb07s Lhe
Displas
and
and emaind.en
ailenen.4
the
LLDLuLl
nombez
Lonapl
qDotlent e
Tdnd hu 1epm, 2puoclut, qwaien!
LAemCLinden tno numbe2 and
a

Publicclass Calulathion
publistatc Vaid main
Steing_ags I)_
int
int ab Rum olil pued, 2uot,_zaeo
55;
b= 45;
Um= t b ) :
dib
DUDd
a -b)
(atb)

Apm =
aj
a o b;

Sys tem-Out. puindln_ The sum


t SOm
Gystem_Ou paulolln74The al
tdiL
The
System-0ut psuintln_ he
LL The puedE
t_Duod
3Hstem_eut-puintln The auot2+Quot
System-0ut: puintln_/EThe uom= 22 +em)
04TE

JOs/e2

Puapsam Wuith apuoguuamto ad Duta,


Peuimekeu
and diopo pal 4 ULtang le

ind ne peuimefCn anddlagena


a ALttangle

Publicclass Rechangle
publi statilYoi main7Stuizg angsl

iot b, 02 Pj
double d
= 24 b= 10

pE 2 +b);
Math:642tt|+ btb);

Sustem-out paintn CLLDO a ALtangle_


t02
Sustem-0Lut puintln_ he_ peuim eten aMectangle-

ystem-out- painiln he di agonala LLtangle =


t d);
DATE

Ruegun f2hhuite_ phnghom tp aep te


te marks
Va shucleat in Phyics
th total meaks
Chemisiy20dholozy
aud aNeHLgr marks

Publi class heuage-


Quplic tatit Void main ftair augsE
Lnt pky, int chem int bio

in 0SUm
lead ug 0-0E
Rum ohy+chomt hio)
avg ur
avg un
kystem Aut peintin_"The lal manks1u
08tenaout puintln The awpeage manks-tAv

autguuann 5-2n_an examination the QUades Aue


gisla to the Budonts an the hasis a aVuaqp marks
abtainec uite_a puoglam tinpul namtane anel

aVleLagemaaks fhat display he guade along_wih


fhe nameAtoading4_
MOUrks naole
80o n d ahove istinch o
60e as mOÃL bul less than 801 Est eiveston
h5 DT MONe bu tess han 60 5etonel VGiem
HO on more but less thor HSt Pas
Less taon 4-0o Afosade Alo qaade
ATE PAGE Na :

uog suam2:- itea pUDuNm to nd


the dihente bea2een sfmpleinteres 7
and
Compound Tnlenes (CT hen
Late CLnc time UL gven kr plinups
Hint T, CT=A-P wheueA= y_ It_R
1OD
publicclass DLeence
public Btahic Moid main8ulng_angsII
int
double i si,ci= 0, anb, dif0
p BOO0 AEt:_t= 2
i-pin 100-D;
amtp Math paul tau/1OD-4 t);
ci-amt=p
oli Ci-si
Suatem0utpaintln_/"The Lompound_Tnienesd-Rs.
LZlaad)ei
Sustem.out_puintlnhe Simple TnteueatPs"; i ;
System-out puiniln The dieence betwee C_
Qnd Si=Rs.; Qloalcl
TE PAGE N

impantjava-lo
2uble class Lade

gublie static void main Stung_tungs hou


TOEReption
nput StsParmReaderLal neLo nputta
-Reaelo System in)
umedTeadenin ne Pruleredkeader laead
fnt m-
SHingpm;
Systerm-out puintln ntanamo tlhhuded
a ded
nm= in -ueadine_
Syskom.out-pauintln_Ent te avage memk_oi
obtaintd ")
m=Tnhgeu- panse Int"4Lade: Pistintion);
im 66Bk m<80)
ys kem-Gut peiintln/"quade: ibst Divisian
m>= tË pe_me60
System outpintln"luade: BeLpnd ivision
(ms=to ea_me4S)
Syatem-outpauintln uadleP58
(m240)
tem-out pintln No Gzade?)
Monday

DATE

hog sua 6 huite _ap/Dguam_ih Java to


aLtép the numbe a cdays and di'splay he
eICsLldQte Covenbn P no humbe
Yeak NumbeU aonthe h e ueimoinin
umbe dy

Duhlie elass days


Puhlcstato_valo aain_nt a

int hm,d
a365

m= b/ 30;
d-b / 80

dysfem-aut plintln_/"he num ben ayeas =ty


0Sstern-auf puintln/Te_nomheu months=tS
ystem eut puintlnEThe numbew a dayt"td

e go uan A class cootains number el heys


boys
AnM numbeu o sls On a wnny lay ha
umbbu bays and ga 2embeu
CLe_absént._Iuite a pilag uam t o LpLd
ho vaulue a b ba and aa'
PACE No
z 202 2

Caladaleand olsplayheollacwine.
aiul PUeLcntIn e
Pouentage eent
pusPn n he
Peucen tage a Heys
Feuntage
smidthe_aalulatral On
he Clatato
n
rlumbeua2shedents

iopoz jaya-io
public alass a i e n t

gpublie sLatio void moamSLeing args L 4


TOxcephia
int , bga,ba
loat pgp
1nput Stutam Readez eLead= neu Tnpudsttam
Readez Gystomin;
enul euedReasduin neu ueurelKOnden i
ystem.oul paintln_("énte_Dumbeagila
and boy a
Tndegeu pase Tnd/in uLadkine
oTnlege_paue lnt in sItaclLiae C);
System-out-pauintln_Ent numbeu _giels_and a
ahsenf in class3);
g Integoz. Pause Tnt_mseLealLipne O
bas Tntegeu Pause Tnt /in-eeudline O
*100
pbloal(4ha/e*100
Systtm-culpeuintln_/ Peicentage_al giulla
in the cluis1g}j
Meney
DATE PAGE N

Systemoulpaulntn_/PpuLpndaqe a
pLcAent in the _alass-rpb

.10guam A_Couuis
aeuw'ce_ehugts
dclively Letden/pamel zo len DehE
as peu theehauges given bela
p p to100 gm 50 50
Gey eauh_aaleltonal100 gm_au _pand theuea 20
Wail a_pauzgOm n Java tnCalulate the chauge
taking twelpht the pautel as an injpt

inmpout inva-te util.*


publc c lassPoucel

Dlblic gtali_val main Stuing augs[I huaues


VTOExteption
SConne in-ne caane Sys tem in
int b, ch= 0 w

y stem-out puîntln_"Enleu wnight a the PaLe


n am 2
w innex{Tnt :
Tutsday

13/099 PAGE No

iloe-10o
ch: 50
y sim.aut puintln ("The_chuuge ahe
h po

else
CL -10o)/10o
b linta
1lab
ch: 50120* r1)
Sysfem aiut palntln "The chuge ea Hhe
pavru Rs.tch)

ugudn - he telephene dlepastanuat ekauuget


uintheiu ubsuibe7s Dumbeu o
Calls made as peu he given able

Numbeua cala Rale


p to 5 callu buee ro Chnge)
T02 ner 100 els p e cal
Jou next 00 Call 1-10 pu eau
350 Calls T1-20 pe Cal
beyond
DATE

lauoeuee Bubsuube hns


e d ontilu ehauge
Jav inputth Umbe
calls paint the onthly bil.
mpoaljava-Lulil.t

hli_e lasg Tolephone


oubllc static voidmainSaiog ougs [1)
Scanne in Dew_Sconno &ystom.in;
int L
dlouhle ch;
Sushemou puintn (énteu numbeu a callh
C550

ch-05
Syslern-outpaintln Arnount n be paid Rs."
t[ch tl 30));
le>=50 &a C2 -150)
ch-(-50)%
yn Lera.outpin_(Amount to he_pai R24
(ch+180)
150 & CA350)
cheLoot)+(e1s0*110
13nsa PASE Ne

Syetent-aul puintn.Arnoon to be4paid eR


h t 1B0)
a350)
ch-ltoot1)+_poofi.1o alc 35o)'12
System-cud palnln_("AotoundtO be pald-k
tlcht 8O)

guam 10:- ih_apuaga1am to _ssiyn twn


nuabes n d t h e gúm d n se_pluodurt
and e LLmainclo a tO0_Numben

ueli alasg 28iaplliabion


publit tatic OL main Stiing_augs II

fal a,b em dl Putd,ium


a- 45 be20;
Com atb,
d a-b
Ded ath,
e a % b:
Sustem.olt puintn "The um wD numh
-2 +8Um
QSstom-autpaintlnqhe diluente h
Dumbes=tdl
(S4stem out puintln 1he_pundut o o
wm bens = 4 puod
OBustem-out guintlo/" lho pumaindeu
numbe 7 +1Lem;_

ROTECI
ueguam heu thuteploousin a hotal-
Tneachoo thene Aue thuee Lategauies sl
Lpoms_wth dleuen hauges Wile
punguam in_ava to _elplay heuoam
Mpnt by enteuing the Loo num bew a
pPey theuseu's ehoice The taulis qlven-
oelbw-
1Guovnd Floos
Class lypes a
V Roam Chaugze

A Deluxe bed 00m 3200


Double bed hoom 250o
Bing bed 20o m 120O
PAGE No
DATE
130922

s loo2

Class pe a Room Onuge


A BupeDeluae 3HO2o
B Delux e 26 Oo
C Classic 50
3Second loo
Class LApes o Keom Ch
auge

A u p eyDeluee H lOO
B Semi Deluxe 3500
Deluxe 180PO

mpout jaya-io-
public tuss Hotel

Public elatie yaid main_(Snqeugs )


thuows THExLepio

int choile
TnpdStueamKeacles eacl=ne Tnput Stren
Readen (Bystem-in);
bukwed Realon in =ne GulkuedReade
utad);
QBysterr-outpeintln ntey f O oLOond
Flop, n
fon Fiug flooM, 5 fo SeLpnA
loo)
DATE

PAGE a

Choice
Tntegeypwse Tnd
gwitth l2hofre) fo- leg line

Q3ystom-Outpuintln_ClsczA Deuxe bea


U00 M Rs.2I00");
08qstem-Olt puintln_"Class: B Dauble_bee
00 m: Ps. 500
Syshem.out puintln Clos: C ngle bld LIOom
Rs. 1OO
bseak
CAse:
Susttm-out puintin "ius1 Flaou)
08stemOut peinth_" The elass, pes a
LA0Om_ancd eh auges U 2
ystem-Out puintln/ Closs :A_uppu_Delure
boluxe
Rs. 340d
Sys tem.outt puinlln/"Llags: B CDeuxe
s.26tDo'2;
Qius tom-0ut puicln las:Clash
R3. 1503
bueaK
LALse3:
Cyatem-eut pzintn"Setond floan);
8'stem-out quiatlnthe class Tupes
LLbom and Chougesaue");_
4sterm oui paiiln 6 Clus A Supe Deluxe
Rs 10ó );_
yske em aut puizln "[lass B Semi Deluke-
Rs 3600
MTE PAGE N
11209

ustem-out pafoln a1s: Drlu


Kg 1800>).
bueak;
delault
L6L MD ng hn
Sustamoud paindin/Duo Choite

You might also like