I have a couple of questions: 1. For the criteriaFind() method, is it necessary to implement a search for all of the possible database fields? For instance, it doesn't make any sense to have a search like "Price=400" or "Time=13:40." What would make sense for these fields would be something like "Price<400" or "Time>=13:40." But the instructions say the syntax of the criteria is "<field name>=<value to match>." What is the consensus? 2.Should a record that has 0 available seats be displayed or filtered out? What's the point of showing a record for which no seats may be booked? Thanks in advance Michael Morris SCJP
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
I took it as a method to search for origin or destination, in which case you would want "=" only. In any case, I look at as a client that wants things a specific way and no discussion is possible. So, I will give them exactly what they are asking for in the most efficient manner that I can. Travis
Hi So , Is it sufficient to take the origin and destination airport datafields for the search criteria ? Thanks -- Ravi
SCJP, SCJD, SCWCD, SCBCD, SCEA
Joined: Jan 30, 2002
Travis, I was leaning that way too, but the example given in the instructions is"Carrier='SpeedyAir',Origin='SFO'". What if a customer only wants SpeedyAir because of their safety record? Or what if a customer must depart on Monday? I am not leaning towards "optional" search pararmeters but am not sure whether to include fields like "Duration" and "Price." I'm also leaning towards displaying flights with no available seats, but disabling the booking mechanism when such records are selected. I would appreciate some feedback on this from anyone who has already passed the exam. Thanks in advancd Michael Morris SCJP
Michael - 1. Only include the three fields they asked for which was Carrier, Departure, and Origin. No need to go overboard. Michael - 2. I showed it. To me it's like why do they show you dates for concerts that are already sold out. Michael - Last Post. For those zero seats available. My approach was this. I had my JTable with the data, I had a JTextBox and a JButton, the JTextbox and JButton are disabled. When the user selects a record in the JTable, if there are seats available, I enable the JTextBox. Then when the user enters something into the JTextBox, I check to make sure it is a number and that it is equal or less than the number of available seats, if it is I enable the JButton. Mark
Hi Mark, First of all I hope you had some nice R&R. As we say down here in Texas, I wuz jest fixin' to ask you to take a look at this post. Thanks for clearing up the requirement on the search criteria. The booking mechanism I had in mind is the same as yours except I was thinking about using a JComboBox and fill it with a list of all possible quantities (ie 1-#available) of course it would have to listen for changes in the JTable selection. My experience has led me to "idiot-proof" user input as much as possible. Of course my experience has also taught me never to underestimate the power of an idiot to find a way to enter garbage input. Do you think the JComboBox is OK? One downside of course would be if there were an inordinate amount of available seats (>30?). Anyway thanks for the reply, any extra information would be appreciated. Michael Morris SCJP
Yes a JComboBox would be completely idiot proof. However, like you said if there are 100 seats available then whew, big ComboBox. How does the travel websites do number of seats. Do they make it go to say 10 and that is the most you can book? I'd follow their rules, if you want to stay with a JComboBox. You can still idiot proof the JTextBox, by using a Document class to keep the user from only entering positive numbers in the field. Either way sounds good to me Mark
In instruction (Creating the user interface) is indicated "The user should be able to select the origin and destination of flights". Does it mean that we have to have two criteria fields for searching or I am wrong?
Originally posted by Andrew Douglas: In instruction (Creating the user interface) is indicated "The user should be able to select the origin and destination of flights". Does it mean that we have to have two criteria fields for searching or I am wrong?
You *must* provide these 2 on your GUI but you can have other as well. You just have to make sure that criteriaFind implementation is generic enough to handle all fields