Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 0 1 1 point Assume that the classes BlankISBN, NegativePrice, and NegativeNumberOrdered are exception classes that inherit from Exception. The following code is a

101
1 point
Assume that the classes BlankISBN, NegativePrice, and NegativeNumberOrdered are exception classes that inherit from Exception. The following code is a constructor for the Book class. What must be true about any method that instantiates the Book class with this constructor?
public Book(String ISBNOfBook, double priceOfBook, int numberOrderedOfBook)
{
if (ISBNOfBook =="n)
throw new BlankISBN();
if (priceOfBook 0)
throw new NegativePrice(priceOfBook);
if (numberedOrderedOfBook 0)
throw new NegativeNumberOrdered(numberOrderedv);
ISBN = ISBNOfBook;
price = priceOfBook;
numberedOrdered = numberOrderedOfBook;
}
It must handle all of the possible exceptions thrown by the constructor or have its own throws clause specifying them.
All of these are true.
It must call the constructor with valid data or a compiler error will occur.
It must contain an inner class that extends the IOException class.
Clear my selection
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions

Question

What is database?

Answered: 1 week ago

Question

What are Mergers ?

Answered: 1 week ago

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago