Results 1 to 5 of 5
  1. #1
    EdOBannon is offline Member
    Join Date
    Nov 2011
    Posts
    12
    Rep Power
    0

    Default Java -- inheritance, exceptions, etc.

    I am having trouble with this assignment. Any help is much appreciated.

    Description
    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”.
    Requirements
    1. There should be 7 classes:
    1. 1. Checkout.java
    2. 2. Pizza.java
    3. 3. SmallPizza.java
    4. 4. MediumPizza.java
    5. 5. LargePizza.java
    6. 6. XlargePizza.java
    7. 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):
    Java -- inheritance, exceptions, etc.-hierarchy.png

    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
    mushrooms pineapple
    onion anchovies

    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.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,839
    Rep Power
    8

    Default Re: Java -- inheritance, exceptions, etc.

    Is there a reason you're choosing to ignore the advice I already gave you?

    Duplicate post: Java -- inheritance, exceptions, etc.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Takashy is offline Member
    Join Date
    Feb 2011
    Posts
    9
    Rep Power
    0

    Default Re: Java -- inheritance, exceptions, etc.

    What exactly do you need help with? Everything or something specific? The one thing I don't get about that assignment is.. why have 4 classes for Pizza? Why not simply have one where you specify the size of it? (I had recently a similar task, but simply couldn't understand why in the world I should make 3 classes that basically contain the same thing, besides their names)

    Sorry about this not being very helpful. :|

  4. #4
    EdOBannon is offline Member
    Join Date
    Nov 2011
    Posts
    12
    Rep Power
    0

    Default Re: Java -- inheritance, exceptions, etc.

    Need help with everything. And I agree, but the teacher wants 4 different classes. Any help would be great!

  5. #5
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,839
    Rep Power
    8

    Default Re: Java -- inheritance, exceptions, etc.

    Quote Originally Posted by EdOBannon View Post
    Need help with everything. And I agree, but the teacher wants 4 different classes. Any help would be great!
    I can't really answer general questions like that. My best advice is to break it down into small pieces, and take those pieces one at a time. When you get stuck on a specific piece, then ask a specific question about that piece only.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Java -- inheritance, exceptions, etc.
    By EdOBannon in forum New To Java
    Replies: 2
    Last Post: 12-07-2011, 05:31 PM
  2. Java Help - Inheritance
    By EdOBannon in forum New To Java
    Replies: 5
    Last Post: 11-06-2011, 02:18 AM
  3. Java exceptions
    By holtaf in forum New To Java
    Replies: 1
    Last Post: 07-04-2011, 03:55 PM
  4. Inheritance in Java
    By socboy6579 in forum New To Java
    Replies: 2
    Last Post: 02-08-2011, 04:40 PM
  5. Client catching Web Service User Exceptions [Java 6.0.17]
    By Shaitan00 in forum Advanced Java
    Replies: 4
    Last Post: 11-22-2009, 01:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •