943,547 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 740
  • Java RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Feb 19th, 2009
1

Re: Help Please Urgent

There are two obvious things you could do as far as how you're thinking about the section of the Seats.

Scenario 1:
Think of the section the seat is in as a property of the seat. (In other words, since the seat will always be in the same section, you could have a variable in the Seat class called section).

Scenario 2:
Think of the section the seat is in as a property of the Theater- not of the seat. In this case, your Theater class could have an array of seats for each section. This is what I would personally do, I think.
Last edited by BestJewSinceJC; Feb 19th, 2009 at 6:09 pm.
Reputation Points: 874
Solved Threads: 352
Posting Maven
BestJewSinceJC is offline Offline
2,758 posts
since Sep 2008
Feb 19th, 2009
0

Re: Help Please Urgent

lol thanks for that reply BestJewSinceJC is there any chance you can explain the second scenario please?? what i dont understand is where should i make the array of seats?? ahhhhhhh
Reputation Points: 10
Solved Threads: 1
Light Poster
Superstar288 is offline Offline
46 posts
since Oct 2008
Feb 19th, 2009
0

Re: Help Please Urgent

Lets say you have three sections. Then you would have three arrays of seats, one for each section.

public class Theater{
-seat array here
-second seat array here
-third seat array here

}
Reputation Points: 874
Solved Threads: 352
Posting Maven
BestJewSinceJC is offline Offline
2,758 posts
since Sep 2008
Feb 19th, 2009
0

Re: Help Please Urgent

@superstar288: You have been given enough hints on where and how to make the array of Seats, also on the attributes about the Seats etc. I suggest if you are still not able to figure this out then you go read some Java Tutorials on classes, array and how to make arrays within classes etc.
Reputation Points: 485
Solved Threads: 89
Posting Shark
verruckt24 is offline Offline
944 posts
since Nov 2008
Feb 19th, 2009
0

Re: Help Please Urgent

A more generalized Theater class design would have either a single collection of seats with the section, price, etc being properties of the seats, or another intermediate collection class to represent seating sections that contained their own collections of seats.

Theaters do not all share common layouts or number of seats, so hard-coding in three arrays for seats ties your implementation to a theater that had three distinct sections of seats with different properties.
Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 838
Posting Genius
Ezzaral is offline Offline
6,756 posts
since May 2007
Feb 20th, 2009
0

Re: Help Please Urgent

I understand reusability and coupling (not sure if the OP does or doesn't) but if I was writing this, I'd probably feel that your suggestion is needlessly complex and doesn't offer enough benefit to justify the extra work. Maybe I'm wrong - I'd like to see a seating collection that actually offers some benefit
Reputation Points: 874
Solved Threads: 352
Posting Maven
BestJewSinceJC is offline Offline
2,758 posts
since Sep 2008
Feb 20th, 2009
0

Re: Help Please Urgent

Putting in a SeatingSection class probably is more complex than the OP needs for this assignment. I just threw that in as a consideration to get them thinking a bit. I think all they really need is a single collection, List or array, of Seats.
Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 838
Posting Genius
Ezzaral is offline Offline
6,756 posts
since May 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Money
Next Thread in Java Forum Timeline: URGENT





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC