Java Assgn 2 2164
Java Assgn 2 2164
Censthruto1)
vol publia Nehod (yB
pobllo
Sytem.
out pnntin ( poblic eLho")y
ved protected ethod
Potccted
publiG void
butprnlo(his e le tord queiton n 7ven
asgment")}
the
inteoace.
Ltrfoce Quodrohc equahgn
Vodtndloots Cdouble a,doude bydoube <);
ass Quodvate Solver ?mplem ents Quadrahe
Equahom
poblic oId hnd foots (deuble
aduble b,des ble c)s
double discuminant b
*b-* at c
b(de cenminanto) {
dovbla nOt 1= (-btyath sqvt (derimunant))J
(*a):
doctte lee tdiecmunan)|(1* a))
are feal and
duyent"
m.oot p u n t t o
6utput
6t e an equilatevol tnangle.
Note: £xcephon hoe to
be degunad in
pubuc
trorgle (s,313))
trarge calcasetres (3,
tnorg
Otout
CATCH
handlng
LhCdenominatorz)
A1LhemehcSycephar (enomnatoy
Cannot be
thioto new
Herogec)
otpt
pet:S
{heuhm o the ty- catth bect u comhete
and corse . Lnitalite Values though pnametemxed Cantrudoy
then
Not cothin
ser deined eAcepth an Ag
Nam e Can kauns nombers or spe uat symbole
the two
t Name Not yaled EXephup. Deyine Cxcepton lacceu,
ctacs
SuperCmecooge);
clacs student
Prvate lnt ol) No
pwate
prae
be between is 11,")
thiiroll d o l o
name)
thù.
("CoUe:+
oy
tudent tnew tuden (4, CJohn oe.
205 Compue uen ce
Jtudent!
botput
Name Johaooe
20
e1ceton be tnDn
pcdic orne
ErceptnCtAng mecagei
Super (me stoge,
Supen (neicage)
omej
nye nt
name ,nt
\nt oge) *hnor omeErceghar
Pgee epnn
Lho NUnenc name)
numher )
this name=0ame,
nt re sult= dvde
Numbers (nomi
;num,
Syemout pin("QesutE:"+ re);Y
Catch(Ath emeth c£ception e)
rhinaly
Scannes close c
`utput
Snter the first integer:l
ner Ahe Seccnd
Caannot iride by Zero
Creake an Account clacc otth dato membere accno, narne, bal.
Include meth ods deposLt Cthdyas C.lae an eeepo
when balance, in acco unt u lees th antO00
Publicclass Aecount Demo §
ivate int accno,
Nale sthng namej
Pywat e double bal;
dooble nthat galant.
PobliG Account ORmotnt aeno, Smng nama
his-a moaccno;
belt >dmoUnti
ba amo unt;
but- prnln es Balonce, 4ba',
Poblic double
ger
(etuyn bal;
Cauch
(E1cepti on e
oot prinln (e-ger
Heeage))
o0t-pntlo (Final Balonce'4accecnt
00tpot
Deposited: \soo.0
Nes Bal ance: 6 50oo
final ealance.1500
rCreate o student clas coEn data membere Rol no, Nae
martr subsets lncude metheds to compute
aveag
Qaise an eceptton b the student hat more than a banlog
class Bockl og¬xception exerds Exephn
Public
ocktcgiscephtan (shing metage
Super Cmeccagej
poblic class Student f
pvvate hhngname,
Int 3 marlcs,
QYvate int tota ubiectsi
pubic Srudent Cent Yol| no,
name Ot tot oJ subec)
this oll noo|lno
thit name name
this tota ubJetS= btalroblets,
thitimarles new ntCtota Sobyect83
+his.nart -marks,
Sum t= mask;
¢etom (douie) sumlto tal ubects
hockegsz o;
fo(int mo :mayk s)
L6Cmosk <yo){
bacttogt+) y
'5Cbactleq2)1
thiow new Bactlog fxceptn (u ttudent hae
more thon Q
poblic St a c vod manC
rodentcheckBacklog(,
Sgctemoot pnto(stod ent ha no tback
fcach
(Bactlog
Sycem ot"py lnlegt Heaiagee);