Help Please Urgent

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Oct 2008
Posts: 29
Reputation: Superstar288 is an unknown quantity at this point 
Solved Threads: 0
Superstar288 Superstar288 is offline Offline
Light Poster

Help Please Urgent

 
0
  #1
Feb 19th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 823
Reputation: verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough 
Solved Threads: 73
verruckt24's Avatar
verruckt24 verruckt24 is offline Offline
Practically a Posting Shark

Re: Help Please Urgent

 
0
  #2
Feb 19th, 2009
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.
Get up every morning and take a look at the Forbes' list of richest people. If your name doesn't appear.... GET TO WORK !!!
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 29
Reputation: Superstar288 is an unknown quantity at this point 
Solved Threads: 0
Superstar288 Superstar288 is offline Offline
Light Poster

Re: Help Please Urgent

 
0
  #3
Feb 19th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 25
Reputation: BrianK123 is an unknown quantity at this point 
Solved Threads: 1
BrianK123's Avatar
BrianK123 BrianK123 is offline Offline
Light Poster

Re: Help Please Urgent

 
0
  #4
Feb 19th, 2009
Originally Posted by Superstar288 View Post
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
int meme=1;
while(meme==1)
{
System.out.println("THIS IS SPARTA!");
}
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 823
Reputation: verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough 
Solved Threads: 73
verruckt24's Avatar
verruckt24 verruckt24 is offline Offline
Practically a Posting Shark

Re: Help Please Urgent

 
0
  #5
Feb 19th, 2009
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.
Get up every morning and take a look at the Forbes' list of richest people. If your name doesn't appear.... GET TO WORK !!!
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 29
Reputation: Superstar288 is an unknown quantity at this point 
Solved Threads: 0
Superstar288 Superstar288 is offline Offline
Light Poster

Re: Help Please Urgent

 
0
  #6
Feb 19th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 823
Reputation: verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough 
Solved Threads: 73
verruckt24's Avatar
verruckt24 verruckt24 is offline Offline
Practically a Posting Shark

Re: Help Please Urgent

 
0
  #7
Feb 19th, 2009
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.
Get up every morning and take a look at the Forbes' list of richest people. If your name doesn't appear.... GET TO WORK !!!
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 29
Reputation: Superstar288 is an unknown quantity at this point 
Solved Threads: 0
Superstar288 Superstar288 is offline Offline
Light Poster

Re: Help Please Urgent

 
0
  #8
Feb 19th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 823
Reputation: verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough 
Solved Threads: 73
verruckt24's Avatar
verruckt24 verruckt24 is offline Offline
Practically a Posting Shark

Re: Help Please Urgent

 
0
  #9
Feb 19th, 2009
Superstar288 sent me a PM mentioning this:
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.,
  1. Seat [] seats = new Seats [10];
Get up every morning and take a look at the Forbes' list of richest people. If your name doesn't appear.... GET TO WORK !!!
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 29
Reputation: Superstar288 is an unknown quantity at this point 
Solved Threads: 0
Superstar288 Superstar288 is offline Offline
Light Poster

Re: Help Please Urgent

 
0
  #10
Feb 19th, 2009
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC