Results 1 to 8 of 8
  1. #1
    sadeem is offline Member
    Join Date
    Apr 2011
    Posts
    12
    Rep Power
    0

    Default hepl out to do shopping mall project

    i have to do this assignment
    CMSC446 Introduction To Design Patterns : Project 1

    but i don't know from where i can get start

    can anyone help to get start ??

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    There are good suggestions for getting started on Patricia Shanahan's So, You Need to Write a Program but Don't Know How to Start page.

    One thing strikes me about the assignment description (well, two things really: the other is the due date...): the classes and their behaviour are very well documented. If I were you I would begin by writing compiliable code with all of the documented attributes and methods. Of course the attributes would be null, and the methods would be "stubs" that were either void or returned null, but the code would at least compile! Then you can start on actually implementing the behaviour.

    Try - right from the start - to document the code as this will help clarify your thoughts about what the program has to do. It will also facilitate communication on a forum like this where others need to know, absolutely precisely, what any given method is supposed to be doing.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    The assignment pretty much tells you exactly what you must do and in pretty decent detail. Start by making the classes that it tells you to make. Do one at a time, testing each bit of code to be sure that it compiles and is as close to error free as possible before moving on to the next bit.

  4. #4
    sadeem is offline Member
    Join Date
    Apr 2011
    Posts
    12
    Rep Power
    0

    Default

    pbrockway2
    abut due date i have the same assignment but the due date at 6 June 2011
    thank alot
    yes i was wrote the null attribute and stub methods for all class
    but i mean how i can get started to implement that

    public class Mall {

    private String name;
    private Stores store;
    private Customer cus;
    public void Enter(Customer c){

    }
    public void Exit(Customer c){

    }
    public ShoppinCart shopcart(){

    }
    public Customer customer(){

    }
    public Stores Store(){

    }
    public void addStore(){

    }
    }
    abstract class Stores {
    String name;
    Item item;
    int Id;
    Observer obs;
    public voir Enter(Customer c){

    }
    public void Exit(Customer c){

    }
    public void add obs(){

    }
    public Item getitem(){

    }

    }
    I try to implement Shoppingcart
    import java.util.*;
    public class ShoppinCart {
    Item item;
    int cus_id;
    ArrayList productList;

    public ShoppinCart(int id){
    this.cus_id=id;
    productList=new ArrayList();

    }
    public void addItem(Item p){
    productList.add(p);
    }
    public void removeItem(Item i){
    productList.remove(i);
    }
    public ArrayList cart(){
    return productList;
    }

    }
    public class Customer {
    String name;
    ShoppinCart cart;
    Stores store;

    public Customer(){

    }


    }

  5. #5
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    To repeat something said by Fubarable and me: compile your code and ensure that it compiles without error. I mention this because the Mall and Stores classes will not compile. If you cannot understand a compiler message, post it here (the whole thing, exactly as you see it) along with the code to which it refers.

    -----

    You say "I try to implement Shoppingcart" and post some code. But, by itself, this is not enough for anyone to work on. If you think about it you will see that there is no question there. What happens when you compile that code, does it compile? If it does compile what happens when you run it?

    Again, compiler messages that you can't understand are best dealt with by saying what they are.

    And with respect to runtime behaviour, if there is a problem you need to say what you expected the behaviour to be. It's up to you how you proceed, but I was serious before in suggesting that you document your code. Each and every method should have a short (1-2 sentence) statement of *exactly* what the method does given the arguments it is passed.

  6. #6
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    I'd suggest you start with the smallest possible class(one which relies on nearly no other classes), and create and test it, slowly building up the project. The more often you compile, the better, you will want to find and fix bugs as quickly as possible. It's easier to compile one class 20 times, fixing one bug per re compile, then simply create the class, compile, and find 20 bugs.

    Also, please use code tags instead of quote tags, this way your code will maintain indentation, making it easier to read. To do this:
    [code]
    YOUR CODE HERE
    [/code]

    Your shopping cart method, while still off by a bit, is a step in the right direction. Have you tried compiling it? What happened when you did? Did you get compile time errors? If so, post the exact error. If you didn't get errors, run it and see what happens(it will be helpful to have a main method in each class for testing purposes.

    I can tell you immediately that as is your shopping cart willgenerate warning, collections(list, set, map, etc) should really take advantage of generics.

    Right now someone could go and add a mall to your shopping cart, which shouldn't be possible, presumably you want your cart to only hold items. Right now your shopping cart takes items of some type and stores them as the Object super type. Without generics you will have to do a lot of messy checking and casting, and debugging of run time errors.

    Thankfully, using generics for what you need is fairly simple. All you do is wrap the type in <>
    Java Code:
    class X{
      ArrayList<X> x = new ArrayList<X>();
      ArrayList<String> s = ...;
      //same as above for any other type. 
    }
    Finally, did you not get a lot if time for the project, or just procrastination(or busy with other stuff).

  7. #7
    ibrahim is offline Member
    Join Date
    May 2013
    Posts
    1
    Rep Power
    0

    Default Re: hepl out to do shopping mall project

    plz i need soluation about this project
    plz send the surce code
    ibrahim.seada@gmail.com

  8. #8
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,520
    Blog Entries
    7
    Rep Power
    20

    Default Re: hepl out to do shopping mall project

    Quote Originally Posted by ibrahim View Post
    plz i need soluation about this project
    plz send the surce code
    ibrahim.seada@gmail.com
    The assignment text also mentions this:

    As in all your work, NO COPYING OR PLAGIARISM. If such is detected, no credit for the project will be given and appropriate actions for academic dishonesty will be taken
    I'm closing this thread.

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Creating a Shopping Cart using JSP
    By lison4luv in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 04-20-2011, 06:18 AM
  2. Hepl me in constructing program
    By saideepak in forum Advanced Java
    Replies: 4
    Last Post: 01-11-2011, 04:18 AM
  3. Trying to validate in a js shopping cart
    By rockc in forum New To Java
    Replies: 1
    Last Post: 02-11-2010, 12:28 AM
  4. need urgent hepl!!!!!!!!!!!
    By ras_pari in forum New To Java
    Replies: 6
    Last Post: 10-30-2009, 05:57 AM
  5. Simple Shopping Cart Help
    By CoOlbOyCoOl in forum NetBeans
    Replies: 0
    Last Post: 05-12-2007, 05:21 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
  •