Working with Inheritance

 

This exercise will provide some practice working with inheritance in Java.

Starting Point

Download RestaurantWorker.java and open it in an IDE. In main there are 2 sections. The first section is ready to run, while the second section is commented out.

Follow the instructions in the Java file to complete the classes RestaurantWorker, Chef, PastryChef and Waitress. Chef inherits from Restaurant Worker, and PastryChef inherits from Chef. Waitress inherits from Restaurant Worker.

When your program is complete, the output should look much like this:



 

When the program is complete, comment out section 1. And try exercises 1 - 7, which are initially commented out in main. You can write your answers to the questions directly in the Java file, and then hand in the Java file when you're done.