Results 1 to 8 of 8
- 06-04-2011, 05:38 AM #1
Member
- Join Date
- Apr 2011
- Posts
- 12
- Rep Power
- 0
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.gif)
can anyone help to get start ??
- 06-04-2011, 05:59 AM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,561
- Rep Power
- 11
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.
-
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.
- 06-04-2011, 07:36 AM #4
Member
- Join Date
- Apr 2011
- Posts
- 12
- Rep Power
- 0
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(){
}
}I try to implement Shoppingcartabstract 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(){
}
}
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(){
}
}
- 06-04-2011, 08:17 AM #5
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,561
- Rep Power
- 11
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.
- 06-04-2011, 11:36 AM #6
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
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 <>
Finally, did you not get a lot if time for the project, or just procrastination(or busy with other stuff).Java Code:class X{ ArrayList<X> x = new ArrayList<X>(); ArrayList<String> s = ...; //same as above for any other type. }
- 05-21-2013, 07:25 AM #7
Member
- Join Date
- May 2013
- Posts
- 1
- Rep Power
- 0
Re: hepl out to do shopping mall project
plz i need soluation about this project
plz send the surce code
ibrahim.seada@gmail.com
- 05-21-2013, 08:00 AM #8
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,603
- Blog Entries
- 7
- Rep Power
- 17
Re: hepl out to do shopping mall project
When people rob a bank they get a penalty; when banks rob people they get a bonus.
Similar Threads
-
Creating a Shopping Cart using JSP
By lison4luv in forum JavaServer Pages (JSP) and JSTLReplies: 3Last Post: 04-20-2011, 06:18 AM -
Hepl me in constructing program
By saideepak in forum Advanced JavaReplies: 4Last Post: 01-11-2011, 04:18 AM -
Trying to validate in a js shopping cart
By rockc in forum New To JavaReplies: 1Last Post: 02-11-2010, 12:28 AM -
need urgent hepl!!!!!!!!!!!
By ras_pari in forum New To JavaReplies: 6Last Post: 10-30-2009, 05:57 AM -
Simple Shopping Cart Help
By CoOlbOyCoOl in forum NetBeansReplies: 0Last Post: 05-12-2007, 05:21 AM


LinkBack URL
About LinkBacks


Bookmarks