/** This program is the solution to problem 11.6 in the textbook. * We use inheritance to calculate the weekly earnings of two different * kinds of workers: Salaried and Hourly. */ public class Driver { public static void main(String [] args) { Salaried s = new Salaried("Sam", 7); Hourly h = new Hourly("Hugh", 6); Worker w = new Worker("Woody", 9); System.out.println(w.computeWages(50)); // Now it's time to find the weekly pay. We call the computeWages() // function which belongs to the general Worker class. // Or we can instead call the computePay() functions that were implemented // in the 2 subclasses -- either way we will have the same answer. System.out.println(s + " made $ " + s.computeWages(35)); System.out.println(h + " made $ " + h.computeWages(32)); } }