943,712 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 740
  • Java RSS
You are currently viewing page 1 of this multi-page discussion thread
Feb 19th, 2009
0

Help Please Urgent

Expand Post »
hello everyone,

im trying to make a theatre program and im at a dead end so im hoping for some help please.
if someone can help see my problem clearer or post some sample code it will be much apperciated.

the problem is i need to create a Seat class in the theatre program but im unsure of how it will work or how i can do it.

i have been asked to create a seating system which will hold around 400 seats. but the seats are split into different sections. e.g upper circle will hold 100 seats etc. it needs to be oop based.

the seats are split into rows and a row of seats my have different pricing e.g. row 1 and 2 may be priced at £10 per seat.

also i have to make sure that the seats are not doubled booked but i really am struggling with how to do all the above.

Last but not least lol can java applets use mvc as i have only done mvc on jframes so im not totaly sure??

all feedback and help is much appericated

thanks
Superstar288
Last edited by Superstar288; Feb 19th, 2009 at 12:12 pm.
Similar Threads
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

Depending on the attributes that different seats may have you can choose to either implement them as different type of seats or keep a 'type' attribute in the Seat class that gives their type, if they do not differ much.

>also i have to make sure that the seats are not doubled booked
To avoid double booking you can keep a flag isBooked in the seat class that tells whether the seat is booked or not.

I assume you are acqauinted with OOPS concepts, if not you can read about that on the net.
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

hey verruckt24 well im not even sure what attributes to have lol i mean i know i would have price, num of seats in row , number of rows and isbooked as you have suggested. can you think of anymore?? also im not sure how isbooked will work do i have to do some check in the class eg query the data in the database?? if you know what i mean.

ummm the thing is most of the seats areas eg upper circle the only difference is the price for each row ect otherwise there identical.
what do you mean by 'type' attribute??

yes i have done some oop before not much though lol thanks for your quick reply
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

also im not sure how isbooked will work do i have to do some check in the class eg query the data in the database??
In the constructer of your seat class, have a boolean for the booked status.

then have a method that simply returns the true or false value of the seat
Reputation Points: 10
Solved Threads: 1
Light Poster
BrianK123 is offline Offline
25 posts
since Feb 2009
Feb 19th, 2009
0

Re: Help Please Urgent

What I meant was, if your seats do differ a lot in attributes other than price you would want to have a different class for each of them, say, UpperCircleSeat, DressCircleSeat, LowerCircleSeat etc. where all of these could be deriving from one common Seat base class. But as you mention that it's not the case, you can just have one Seat class with attributes such as Price, Type (UpperCircle,LowerCircle etc), isBooked, SeatNo which could be combination of row number and seat number within that row say, A4, F5 etc. These are all the attributes that come to mind.
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

ok kool thanks for the help so much everyone its much apperciated.
i will try and make this class tonight.
but what i dont understand is, do i then eg make an array for the rows and seats eg have an array for upper circle which has a1,a2, a3 ect. and have them as a default array so they can be used all the time if you know what i mean.
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

As I mentioned in first post you need to model your program close to the real world scenario. In our world a Theatre is made up of a collection of seats, so what you can do is, make a Seat class as suggested in the previous posts and then you could have an array of the Seat objects.
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

Hey thanks for your quick reply once again, i understand what you mean. but can i construct that array in the seat class like int[] upper= {1,2,3,4,5,6,7,8,9,10}; for the seats?
or would i have to make it seperate?? sorry im only learning java not had 2 much experince you see.
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

Superstar288 sent me a PM mentioning this:
Quote ...
Hey thanks for your quick reply once again, i understand what you mean. but can i construct that array in the seat class like int[] upper= {1,2,3,4,5,6,7,8,9,10}; for the seats?
or would i have to make it seperate?? sorry im only learning java not had 2 much experince you see.
Create a Seat class and then create an array of Seat objects the same way you would create one for String or int etc.,
java Syntax (Toggle Plain Text)
  1. Seat [] seats = new Seats [10];
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

kool thanks very much guys will try this later on tonight and try and get it done. i feel you have helped me understand this much better and i feel more confortable than before. i will let you know the end result cheers
Reputation Points: 10
Solved Threads: 1
Light Poster
Superstar288 is offline Offline
46 posts
since Oct 2008

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