help with java problem -
this question school work dont want complete answer how should go doing each part or clarifying question asking for
in following method, call
getcreditcardnumber()
may throwinvalidlengthexception
,nonnumericexception
orinvalidcardnumberexception
. modify method following:
a. catchinvalidlengthexception
, print message “card number must 16 digits.”
b. catchnonnumericexception
, print message “card number must numbers only.”
c. passinvalidcardnumberexception
on calling method. in other words, don’t catch it, let calling method uses method know may throwinvalidcardnumberexception
.
public void getorderinformation() { getcreditcardnumber(); }
without providing exact code, per request, you'll need wrap call getcreditcardnumber() in try
/catch
block using mutliple catch
statements.
this how java, , other languages, perform exception handling. read quick tutorial , give shot.
Comments
Post a Comment