Question: There are two completely different parts for this assignment. The first will be to create and use a custom exception, and the second to create
There are two completely different parts for this assignment. The first will be to create and use a custom exception, and the second to create an abstract class.
Write Java programs that meets the following requirements with good programming style using concepts covered through chapter 13.
Part 1. Using assignment 4, define a Custom Exception Class that prints a message if the user orders a bread or filling that is not offered by the sandwich shop. Next make a change to the Sandwich Ordering program by adding a try catch block to check the input, provide a message that states the problem and allows the user to enter the correct bread or filling.
Part 2. Create an abstract Bird class with fields for color and subspecies, including get and set methods for both these fields. Include an abstract method for sound. Create two subclasses for individual species of bird (for example, Chicken or Dove) which overrides the sound method. Finally write an application that uses the subclasses to create the objects and display information about the different birds. Possible output could be: I am a chicken type Longhorn, my color is white and I cluck.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
