| Author |
dvd club application
|
michael delta
Ranch Hand
Joined: Aug 11, 2009
Posts: 35
|
|
Hello,I could use some help for my assignment!
It's a little bit complicated so I'll try to keep it simple.
I have to make a dvd club application which keeps a catalog with movies/games for rent.
Each movie has different categories such as: action,comedy,drama,romance. Each move belongs to one or more of these categories.
The characteristics of the movies are: director,actors,year of production,duration and categories.
For games (categories like: FPS,strategy,sport etc) and characteristics : platform,year,categories.
So,there's is a catalog with the rented movies/games and a catalog with the available movies/games.
Characteristics of the rent are: rent serial(unique number),game/movie rented,customer(name,number,address),day of rent,how many days were rented,price,price for extra day.
I wont bother you with the further implementation,I just need a little help with the construction of the hierarchies here.
So far,I created a class Rent in which I use composition with the class Movies,class Games,class Date and Class Customer(Used them as field members for class Rent).
Also I made class Rent a superclass of classes Movies and Games. Does this make any sense?
|
 |
Janeice DelVecchio
Saloon Keeper
Joined: Sep 14, 2009
Posts: 1611
|
|
You should start with the following tools:
Pencil
Paper
and start by sketching out what is related to what and how things are related.
Be sure to think about what things ARE something else and which things HAVE which other things.
|
When you do things right, people won't be sure you've done anything at all.
|
 |
michael delta
Ranch Hand
Joined: Aug 11, 2009
Posts: 35
|
|
That's what I'm trying to do,but I can't relate things quite well.
My main concern is that while Rent has some fields that Movies and Games classes could use in common(and that means I can use inheritance,with the Rent class as a superclass),on the other hand the Rent class doesnt seem to act as a superclass in a logical way(for example Movie is not a Rent).
|
 |
Janeice DelVecchio
Saloon Keeper
Joined: Sep 14, 2009
Posts: 1611
|
|
Rent HAS-A dvd or game
dvd and game should be subclasses of something, and rent should HAVE-A something as a property.
That's how I'd do it.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32694
|
|
Janeice DelVecchio wrote:You should start with the following tools:
Pencil
Paper
Beware, Janeice, you are beginning to sound like me You have however forgotten the third tool required: an eraser
|
 |
John de Michele
Rancher
Joined: Mar 09, 2009
Posts: 600
|
|
Campbell Ritchie wrote:Beware, Janeice, you are beginning to sound like me  You have however forgotten the third tool required: an eraser
Don't you know that the v2.0 of the Pencil API added an erase() method?
John.
|
 |
michael delta
Ranch Hand
Joined: Aug 11, 2009
Posts: 35
|
|
Hmm I feel a little narrow minded here hadnt thought about creating a class Product or something, to inherit movies and games classes and then use composition in rent class. That should work fine,thank you.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32694
|
|
John de Michele wrote: . . . added an erase() method?
John.
Yes, but I have 2 inch long eraser which I got for about 89p (about €1.00 or US$1.35), so I can bounce it about or wave it at our undergraduates and say, "This is the bit of hardware you really need!"
|
 |
Janeice DelVecchio
Saloon Keeper
Joined: Sep 14, 2009
Posts: 1611
|
|
Campbell Ritchie wrote:
Janeice DelVecchio wrote:You should start with the following tools:
Pencil
Paper
Beware, Janeice, you are beginning to sound like me  You have however forgotten the third tool required: an eraser
Erasers are for fools who make mistakes.... since I am virtually perfect, I don't need erasers
|
 |
michael delta
Ranch Hand
Joined: Aug 11, 2009
Posts: 35
|
|
Hey,after I mastered my pencil (and eraser) skills, I'm back with another question
So,the tutor said that we have to create two collections (one for the available dvds and one for the rented dvds)
I'm totally irrelative with collections as I only had experience with simple arrays.
Which collection do you think would suit me better in this occation and why?
|
 |
Janeice DelVecchio
Saloon Keeper
Joined: Sep 14, 2009
Posts: 1611
|
|
Here's the API for Collection:
http://java.sun.com/javase/6/docs/api/java/util/Collection.html
Take a look at List (it's pretty common and easy to use). Then take a look at the implementing classes and see if you can take a more educated guess.
|
 |
michael delta
Ranch Hand
Joined: Aug 11, 2009
Posts: 35
|
|
|
Cool,thank you.
|
 |
 |
|
|
subject: dvd club application
|
|
|