Results 1 to 3 of 3
- 12-07-2011, 06:17 PM #1Member
- Join Date
- Nov 2011
- Rep Power
Java -- inheritance, exceptions, etc.
I am having trouble with this assignment. Any help is much appreciated.
For this assignment you will create a program that simulates a pizza ordering system that allows a user to choose a small, medium, large, or xlarge pizza and load it with up to 12 toppings, then display a detailed summary of the order with the total cost amount and store the order to a file in memory called “OrderHistory.txt”.
1. There should be 7 classes:
- 1. Checkout.java
- 2. Pizza.java
- 3. SmallPizza.java
- 4. MediumPizza.java
- 5. LargePizza.java
- 6. XlargePizza.java
- 7. PizzaTestDrive.java
2. You must use object oriented design (OOD).
3. You must use inheritance.
4. The assignment hierarchy MUST adhere to the following structure (but use your own class names):
5. Checkout interface explanation:
0. getTotalPrice returns the total price of the order
1. saveOrder saves all the order details to a local file on the system “OrderHistory.txt”.
6. Pizza class explanation:
0. toppings is an ArrayList of Strings used to store the toppings ordered for the pizza
1. getToppings gets the reference variable to the toppings ArrayList
2. addTopping takes in a topping String argument and adds it to the toppings ArrayList
3. numOfToppings gets the number of toppings ordered, that is the size of the topping ArrayList
7. Small, Medium, Large, and Xlarge Pizza classes explanation:
0. toppingPrice is an instance variable that holds the price of the toppings: $0.25 for a small, $0.5 for a medium, $0.75 for a large, and $1 for a Xlarge
1. PizzaPrice is an instance variable that holds the price of the pizza: $4 for a small, $8 for a medium, $10 for a large, and $12 for a Xlarge
8. Your PizzaTestDrive class must welcome the user and ask what size pizza they want, then what toppings they want on the pizza, and finally display their order details and total price, as well as write all the order information to the file “OrderHistory.txt”.
9. There MUST be the following topping choices:
pepperoni green peppers
sausage hot peppers
ham green olives
bacon black olives
11. The correct use of access levels must be used in all classes: i.e. use the ‘private’, ‘public’, and ‘protected’ keywords where appropriate.
12. ALL exceptions MUST be caught in a catch block.
- 12-07-2011, 06:22 PM #2
Re: Java -- inheritance, exceptions, etc.
Your question as asked isn't really answerable. I suggest you read through the link in my signature on asking questions the smart way. Where exactly are you stuck?
- 12-07-2011, 06:31 PM #3
- By EdOBannon in forum New To JavaReplies: 4Last Post: 11-06-2011, 04:48 AM
- By EdOBannon in forum New To JavaReplies: 5Last Post: 11-06-2011, 03:18 AM
- By holtaf in forum New To JavaReplies: 1Last Post: 07-04-2011, 04:55 PM
- By socboy6579 in forum New To JavaReplies: 2Last Post: 02-08-2011, 05:40 PM
- By Shaitan00 in forum Advanced JavaReplies: 4Last Post: 11-22-2009, 02:09 AM