| | |
Help Please Urgent
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2008
Posts: 29
Reputation:
Solved Threads: 0
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
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.
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.
>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 !!!
•
•
Join Date: Oct 2008
Posts: 29
Reputation:
Solved Threads: 0
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
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
•
•
•
•
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??
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!");
}
while(meme==1)
{
System.out.println("THIS IS SPARTA!");
}
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 !!!
•
•
Join Date: Oct 2008
Posts: 29
Reputation:
Solved Threads: 0
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.
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.
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 !!!
Superstar288 sent me a PM mentioning this:
Create a Seat class and then create an array of Seat objects the same way you would create one for String or int etc.,
•
•
•
•
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.
java Syntax (Toggle Plain Text)
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 !!!
![]() |
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 |
3d @param affinetransform android api applet application arc arguments array arrays automation binary bluetooth byte capture chat class classes click client code color compare component count database design detection eclipse eclipsedevelopment encryption error event exception fractal game givemetehcodez graphics gridlayout gui guitesting helpwithhomework html ide if_statement image input integer interface j2me java java.xls javaprojects jni jpanel julia keytool keyword linux list loop macintosh map method methods mobile netbeans newbie object os pong print problem producer program programming project projectideas read recursion replaysolutions rim scanner screen server set size sms sort sql string swing terminal threads transforms tree ui web windows





