Results 1 to 2 of 2
  1. #1
    JavaCake is offline Member
    Join Date
    Dec 2012
    Posts
    5
    Rep Power
    0

    Question Online pizza ordering system project - need help for university coursework!

    Hi all,

    I am a complete beginner in Java and things are moving quite quickly at university and I'm having difficulty keeping up. I have a project and I will share the specifications and show you what I've done so far. It may be completely awful, and the specification is quite long but I'd be very happy if you'd just bear with me and give me a hand, I've got 8 days to finish this and not sure how I'm going to do it!

    Background

    As part of a larger project, building an online ordering system for a Pizza company, you need to design and implement a system for calculating the costs and some other features about a pizza. The system will allow you to build a pizza from a base and some toppings.

    Task

    Your task is to create a prototype which allows cost calculations for pizzas.

    You will need at least three classes.

    Pizza
    This should carry all the essential information about a pizza, including a single base and some toppings.

    PizzaBase
    This class should model a pizza base. You will need at least two, one thick and one thin.

    PizzaTopping
    This class should model a pizza topping. You need at least four toppings, but you may provide as many as you choose. If you are not an expert on pizza, you can find toppings by searching for a pizza menu on the web.

    For later stages of this coursework, you will build a simple user interface. This is a prototype system, so the user interface does NOT need to be complex; a simple command-line interface using Scanner and println statements is entirely sufficient. However, as your classes may be used in several different situations, none of Pizza, PizzaBase nor PizzaTopping should require any user interaction.

    There are a number of features that you should attempt to achieve; please complete these in the order given.

    Build a Pizza
    The initial version of your system should allow enable you to create objects for a pizza, one base and several toppings. Each of the ingredients should have a cost associated with it. You should be able to combine these to create a pizza which should have one and only one base, but many toppings. The finished pizza should calculate it’s cost. You should write a simple class called PizzaBuild which contains a main method which demonstrates this working.

    Create a user interface
    Create a new class called PizzaChoice. This should have a main method, and class should provide a simple user interface. This should provide you with a choose of one base, and a number of toppings. It should compose the objects that you created in the previous task. Once complete, you should print a short report showing all the ingredients, the price for each and the total cost. The report should be formatted for easy reading. You may create additional classes, beyond PizzaChoice should you find this useful.

    Named Pizza
    Sometimes, there can be too many choices in life. Write a new class PizzaMenu, with a main method, which allows the user to choose from a menu of predefined pizza’s. For instance, a Margherita pizza consists of tomato, mozzarella and basil, on a thin base. You should provide the user with a choice of at least three pizzas. As before, you should print a short report showing all the ingredients. You may create additional classes beyond PizzaMenu should you find this useful.

    Vegetarian Options
    Modify your PizzaToping, PizzaBase and Pizza classes so that the contain a property which describes whether they are vegetarian or not. A pizza should be vegetarian if and only if all of its ingredients are. Extend the reports produced by the last task so that they clearly state whether the pizza is suitable for vegetarians.

    So, here is my code so far:

    Java Code:
    import java.util.ArrayList;
    import java.util.List;
    
    public class Pizza {
    
    	//PizzaBase base = new PizzaBase("");//scanner input from pizzabuild?
    	List<PizzaTopping> toppings = new ArrayList<PizzaTopping>();
    	
    	public void putBase(String b){
    		PizzaBase base = new PizzaBase(b);
    		base.equals(b);
    	}
    	
    	public void addToppings(String t){
    		PizzaTopping topping = new PizzaTopping(t);//scanner input from pizzabuild?
    		toppings.add(topping);
    	}
    	
    	public void listToppings(){
    		
    	}
    	
    }
    ----------------

    public class PizzaBase {

    private String base;
    private double cost;

    PizzaBase(String b){
    base = b;

    if(base.equals("thin")){
    setCost(1.8);
    }

    else if(base.equals("thick"))
    setCost(2.0);
    }

    public double getCost() {
    return cost;
    }

    private void setCost(double cost) {
    this.cost = cost;
    }
    }
    ---------------------

    public class PizzaTopping {

    private String topping;
    private double cost;

    PizzaTopping(String t){
    topping = t;

    if(topping.equals("olives")){
    setCost(0.1);
    }

    else if(topping.equals("corn")){
    setCost(0.15);
    }

    else if(topping.equals("mushrooms")){
    setCost(0.2);
    }

    else if(topping.equals("pineapple")){
    setCost(0.25);
    }}

    public double getCost(){
    return cost;
    }

    private void setCost(double cost) {
    this.cost = cost;
    }
    }[/CODE]

    Any advice, recommendations, any mistakes or problems? Please do help if you can, I'd be very grateful. As I said, completely new to Java and not sure what I'm doing to be honest so my code may be completely wrong. It's not complete obviously, I just need to know how I'm doing and what I should do next..

    Thanks if you do read all of this and can be bothered to reply!!
    Last edited by JavaCake; 12-06-2012 at 05:01 PM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,305
    Rep Power
    20

    Default Re: Online pizza ordering system project - need help for university coursework!

    Please go through Guide For New Members and BB Code List - Java Programming Forum and edit your post accordingly.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Pizza Order System
    By pinkdreammsss in forum Java Applets
    Replies: 7
    Last Post: 10-09-2011, 09:31 PM
  2. Online Examination System
    By jyothi.priyanka in forum New To Java
    Replies: 7
    Last Post: 07-30-2010, 07:56 PM
  3. Help for University Project
    By ja107 in forum Networking
    Replies: 3
    Last Post: 03-18-2010, 10:22 AM
  4. Help for University Project
    By ja107 in forum Networking
    Replies: 1
    Last Post: 03-04-2010, 12:22 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
  •