Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Im creating a Pizza object. It has the following characteristics: - Topping1 (String) - Topping2 (String) - Topping3 (String) - Size (char) - Price

1. I’m creating a Pizza object. It has the following characteristics:

- Topping1 (String)
- Topping2 (String)
- Topping3 (String)
- Size (char)
- Price (double)

I am overloading the constructor for multiple toppings.

Which of the following objects would I consider valid?
    A.     Pizza pizza8 = new Pizza(“Bell Peppers”, “Olives”, “Mushrooms”, ‘M’, -14.99);
    B.     Pizza pizza72 = new Pizza(“Cheese”, ’S’, 12.99);
    C.     Pizza pizza10 = new Pizza(“Ham”, “Pineapple”, ‘M’, 15.99);
    D.     Pizza pizza534 = new Pizza(“Bacon”, “Jalapeños”, “Onions”, ’S’, 24.99);
    E.     Pizza pizza600 = new Pizza(“Pepperoni”, “Sausage”, “Mushrooms”, ‘L’, 19.99);

2. I am creating a custom object class called NativeHawaiianPlant. Which exception should I use to validate an instance of this class?
    A.     InputMismatchException
    B.     StringIndexOutOfBoundsException
    C.     FileNotFoundException
    D.     IOException
    E.     ArithmeticException
    F.     ArrayIndexOutOfBoundsException
    G.     None of these choices are correct

3. I’m working on this week’s assignment and I receive the error “unreported exception; must be caught or declared to be thrown”  What should I do to resolve the error?
    A.     None of these choices are correct
    B.     If working with an object in my driver class, catch the exception with try-catch
    C.     Create a custom exception to validate the object
    D.     If working on my object class’s mutator methods, catch the exception with try-catch
    E.     If working with an object in my driver class, declare that the method throws the exception
    F.     If working on my object class’s mutator methods, declare that the method throws the exception

4. Which of the following are true about exceptions?
    A.     We use the word extends because a custom exception is a subclass of Exception
    B.     When we create a custom object class, we can run a custom exception class to help us validate the object
    C.     When creating our custom exception class, we must have: instance variable(s)
    D.     When creating our custom exception class, we must have: constructor
    E.     When creating our custom exception class, we must have: accessor/mutator method(s)
    F.     When creating our custom exception class, we must have: toString method
    G.     None of these choices are correct

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Answering Each Question Step by Step 1 Valid Pizza Object In objectoriented programming the validity of an object creation depends on how the constructor of the class is defined For a Pizza object ass... 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

Fundamentals Of Financial Management

Authors: James Van Horne, John Wachowicz

13th Revised Edition

978-0273713630, 273713639

More Books

Students also viewed these Programming questions

Question

Would giving rewards or administering punishments be

Answered: 1 week ago