Thin or thick crust?
Apr 28, 2003 4:34:49 GMT -5
Post by M. Beaux-Eaux on Apr 28, 2003 4:34:49 GMT -5
Comp 212 Assignment #1
The Ultimate Pizza Experience
No Late Submission will be accepted
This homework exercise serves as a transition from functional programming to object-oriented programming. It also serves as a "dry run" for the larger programming projects that will come later. It is based on the pizza example discussed in class.
You may discuss the homework with other classmates at a high level. However, you may not share your code nor your design with your classmates.
I. Modeling Pizzas
Pizza Unlimited will customize their pizzas to any shape you want. Ready to go are 4" x 6" rectangular pizzas and 5" diameter round pizzas. The pizzas come in two standard kinds of crust: thin and thick. The thin crust is chewy and costs the house $0.15/in2 to make. The thick crust is crunchy and costs the house $0.17/in2 to make. Besides these standard crusts, Pizza Unlimited will customize the crust to your specification as well. Of course, the cost per in2 for customized crusts will vary. The pizzas of different shapes and crusts are sold at various prices. Pizza Unlimited wants to know which the most profitable kind of pizza is. For example, is the 4" x 6" thin crust at $4.99 more profitable than the 5" round thick crust at $4.69?
Use UML to describe the design of your pizzas. 25 pts
Write the Java code for your pizza design. 25 pts
Override the toString() method in appropriate classes of your pizza design to return a String representation of a pizza that shows its price, its shape with the relevant dimension, and the crust type. For example, the standard 4" x 6" thin crust at $4.99 has the String representation: [$4.99 Rectangle(4, 6) thin and chewy]. 5 pts
Write a client test class. The test class must cover all possible combination of shapes and crusts. 5 pts
Given two pizzas, each of certain shape, crust, and price, write an appropriate class to find out which one is more profitable and return it. 5 pts
Write a client test class. What cases should the test cover? Explain your reason for testing only those cases. 5 pts
Given three pizzas, each of certain shape, crust, and price, write an appropriate class to find out which one is more profitable and return it. 5 pts
Write a client test class. What cases should the test cover? Explain your reason for testing only those cases. 5 pts
Given a pizza and a list of pizzas, each of certain shape, crust, and price, write an algorithm to find out which one is more profitable and return it. You must add appropriate methods to IList and its concrete implementations EmptyList and NEList to carry out the algorithm. You will be graded on the appropriateness and correctness of your methods. 10 pts
Write a client test class. What cases should the test cover? Explain your reason for testing only those cases. 5 pts
II. General Instructions
Functional programming as a subset of object-oriented programming: All programs in this exercise should be written in a purely functional style: no object fields should be modified once they have been initialized by a constructor.
Documentation and coding style: As with all programs in this course, lack of good coding style (good style includes reasonable variable names, a comment preceding each method, consistent indentation) will result in a substantial loss of points. The provided java files in the labs and lectures can serve as examples of coding style and documentation format that are acceptable to us. For the de-facto Java coding standard, check out the link: java.sun.com/docs/codeconv/.
- www.owlnet.rice.edu/~comp212/03-spring/hw/01/
The Ultimate Pizza Experience
No Late Submission will be accepted
This homework exercise serves as a transition from functional programming to object-oriented programming. It also serves as a "dry run" for the larger programming projects that will come later. It is based on the pizza example discussed in class.
You may discuss the homework with other classmates at a high level. However, you may not share your code nor your design with your classmates.
I. Modeling Pizzas
Pizza Unlimited will customize their pizzas to any shape you want. Ready to go are 4" x 6" rectangular pizzas and 5" diameter round pizzas. The pizzas come in two standard kinds of crust: thin and thick. The thin crust is chewy and costs the house $0.15/in2 to make. The thick crust is crunchy and costs the house $0.17/in2 to make. Besides these standard crusts, Pizza Unlimited will customize the crust to your specification as well. Of course, the cost per in2 for customized crusts will vary. The pizzas of different shapes and crusts are sold at various prices. Pizza Unlimited wants to know which the most profitable kind of pizza is. For example, is the 4" x 6" thin crust at $4.99 more profitable than the 5" round thick crust at $4.69?
Use UML to describe the design of your pizzas. 25 pts
Write the Java code for your pizza design. 25 pts
Override the toString() method in appropriate classes of your pizza design to return a String representation of a pizza that shows its price, its shape with the relevant dimension, and the crust type. For example, the standard 4" x 6" thin crust at $4.99 has the String representation: [$4.99 Rectangle(4, 6) thin and chewy]. 5 pts
Write a client test class. The test class must cover all possible combination of shapes and crusts. 5 pts
Given two pizzas, each of certain shape, crust, and price, write an appropriate class to find out which one is more profitable and return it. 5 pts
Write a client test class. What cases should the test cover? Explain your reason for testing only those cases. 5 pts
Given three pizzas, each of certain shape, crust, and price, write an appropriate class to find out which one is more profitable and return it. 5 pts
Write a client test class. What cases should the test cover? Explain your reason for testing only those cases. 5 pts
Given a pizza and a list of pizzas, each of certain shape, crust, and price, write an algorithm to find out which one is more profitable and return it. You must add appropriate methods to IList and its concrete implementations EmptyList and NEList to carry out the algorithm. You will be graded on the appropriateness and correctness of your methods. 10 pts
Write a client test class. What cases should the test cover? Explain your reason for testing only those cases. 5 pts
II. General Instructions
Functional programming as a subset of object-oriented programming: All programs in this exercise should be written in a purely functional style: no object fields should be modified once they have been initialized by a constructor.
Documentation and coding style: As with all programs in this course, lack of good coding style (good style includes reasonable variable names, a comment preceding each method, consistent indentation) will result in a substantial loss of points. The provided java files in the labs and lectures can serve as examples of coding style and documentation format that are acceptable to us. For the de-facto Java coding standard, check out the link: java.sun.com/docs/codeconv/.
- www.owlnet.rice.edu/~comp212/03-spring/hw/01/