Latest News

 










Exercises

Previous slide Next slide Back to first slide View graphic version


Exercises


 
My other sites

Latest News

 










Exercises

  • Create an abstract aBottle class and three subclasses : Beer, Wine and Whiskey. Create a StorageHouse class to contain bottles. Make it empty and create methods for putting and retrieving bottles. Use it from your main method and add several concrete classes. Then create an Exception of the type NoBottleException to be thrown whenever you ask the StorageHouse for a bottle that doesn’t exist. Catch the exception accordingly and output an error message without interrupting the execution of the program. Finally add the four bottle classes to a bottles package and access them from there. Feel free to improvise to support your decisions.

Previous slide Next slide Back to first slide View graphic version