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 throw invalidlengthexception, nonnumericexception or invalidcardnumberexception. modify method following:
a. catch invalidlengthexception , print message “card number must 16 digits.”
b. catch nonnumericexception , print message “card number must numbers only.”
c. pass invalidcardnumberexception on calling method. in other words, don’t catch it, let calling method uses method know may throw invalidcardnumberexception.

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

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -