Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Seat booking problem

 
Anurag Mishra
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When do you lock intf?
- Mike
 
Anurag Mishra
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic