File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Seat booking problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Seat booking problem" Watch "Seat booking problem" New topic
Author

Seat booking problem

Anurag Mishra
Ranch Hand

Joined: Sep 27, 2001
Posts: 133
I am unable to design my seat booking method this a sample of my code id as follows but i am not satisfied with this code plz if any one have better idea how to design my seat booking method i will be very thankful.
My Code:
private void book(String f_seats){
try{
totalSeats=Integer.parseInt(label18.getText().trim());
if(totalSeats<=0){
prompt("Sorry !! no seats left","Message");
}
else {
seatsLeft=(totalSeats-(Integer.parseInt(f_seats)));
String msg[]={label10.getText(), label11.getText(), label12.getText(), label13.getText(), label14.getText(), label15.getText(), label16.getText(), label17.getText(), String.valueOf(seatsLeft)};
intf.modify(new DataInfo(record, intf.getFieldInfo(), msg));
intf.unlock(record);
prompt("Seats Booked","Message");
}
}
Plz Help me out
Anurag Mishra
Mike Birken
Greenhorn

Joined: Dec 28, 2001
Posts: 20
When do you lock intf?
- Mike
Anurag Mishra
Ranch Hand

Joined: Sep 27, 2001
Posts: 133
I lock in Booking Method
private void booking(int rec){
intf.lock(rec);
info=intf.getRecord(rec);
......Displays the record details on GUI
and when number of seats are entered
It calls the book method as stated earlier
and unlocks record
}
The working is performed lik this
lock-->read-->modify-->unlock
Plz help me out
Anurag Mishra
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Seat booking problem