PizzaClient.java
Created with JBuilder
/**
 * Pizza Mania is having a special on the same kind of pizza (i.e. same thickness
 * and same ingredients). The special comes in two shapes: rectangular (4" by 6")
 * for $4.99 and round (5" in diameter) for $3.99. Which one is the better deal?
 * Write a program to solve this problem. Why do we want to write a program to
 * solve something as simple as this one anyway?
 * @author Dung X. Nguyen
 * @Copyright 2002 by Dung X. Nguyen - All rights reserved.
 */
public class PizzaClient {

    /**
     * Prints the answer to the problem stated in the above. 
* Question to students: explain the output. */ public void run() { Pizza round = new Pizza (3.99, new Circle (2.5)); Pizza rect = new Pizza (4.99, new Rectangle (6, 4)); PizzaDeal pd = new PizzaDeal(); System.out.println(round + " is a better deal than " + rect + ": " + pd.betterDeal(round, rect)); } /** * Main entry to the program to find the better deal. * Instantiates an instance of PizzaClient and tells it to run. * This is what all main() should do: instantiates a bunch of objects and * "turn them loose"! * There should no complicated logic and/or control in main(). * @param nu not used */ public static void main (String[] nu) { new PizzaClient().run(); } }
PizzaClient.java
Created with JBuilder