| | |
Help Please Urgent
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Sep 2008
Posts: 1,638
Reputation:
Solved Threads: 206
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.
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.
@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.
Get up every morning and take a look at the Forbes' list of richest people. If your name doesn't appear.... GET TO WORK !!!
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.
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.
•
•
Join Date: Sep 2008
Posts: 1,638
Reputation:
Solved Threads: 206
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
![]() |
Similar Threads
- pls heeeeeeeeelp its urgent. (C)
- Urgent! (C++)
- URGENT: Need help on I/O code! (Java)
- Urgent help (Networking Hardware Configuration)
- Homepage keeps switching back to a porn site (Web Browsers)
- Importing SQL Script File - Urgent !! (Database Design)
Other Threads in the Java Forum
| Thread Tools | Search this Thread |
Tag cloud for Java
affinetransform android api apple applet application arc arguments array arrays automation binary bluetooth businessintelligence chat class classes client code component database desktop draw ebook eclipse encode equation error event exception file fractal game givemetehcodez graphics gui helpwithhomework html ide image input integer intersect j2me java javaexcel javaprojects jmf jni jpanel julia linked linux list loop mac main map method methods mobile netbeans newbie number object open-source oracle parameter print problem program programming project properties recursion reference replaysolutions rotatetext scanner score screen scrollbar server set size sms socket sort sql string superclass swing template test threads time tree windows working xstream






