• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The 2nd contructor of the Data class

 
ruilin yang
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am in the middle of the way to finish my assighment.
You know the Data class provided by Sun has 2 constructors. I have not seen the need to use the 2nd one.
Does anybody have used it in the assignment ? Could you tell me when I need to use it or I do not need to use it.
Thanks
Ruilin
 
Aleksey Matiychenko
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure why everybody was ignoring this issue but think about what happens when user books a flight.
Ok we use a data class and modify the number of available seats in the db.db file. That's fine. But how do we show user what flight he/she booked. We can use a simple Table to display it but what if the user disconnects and comes back?
In this case the number of seats on the server reflects user's booking but the user does not have that information.
I think the second constructor was created so you can set up user information table and preserve reservation information there.
But that's just a thought. I might be wrong
 
ruilin yang
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aleksey
You comments is great. I thought something in that way. If I use the 2nd constructor to save the reservation inf, I need to modify the schema to include the traveller's name and probably the booking data, etc.
Furthermore, the assignment does not ask to implement a login to collect userID. Without a userID, the system will not know who used the system and made a booking.
Please comments,
Ruilin
 
luis veron
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think sun was expecting people to use the first constructor in conjunction with the conversion tool. But since lately when sun modified the instruction.html and the .jar file (assignment), they just provided us the db.db. No need to create a conversion tool
luis
 
Aleksey Matiychenko
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The assignment says that requirements are purposely incomplete.
I don't think a reservation system that cannot save and report my reservations is any good.
But that's just me
 
Matt DeLacey
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use modify to preserve your booking.
 
Aleksey Matiychenko
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What database file would you modify?
 
Matt DeLacey
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure I understand your question.
You said, "I don't think a reservation system that cannot save and report my reservations is any good."
and I was just pointing out that you can modify the db.db file using the modify method. Everyone was talking about using the 2nd constructor and nobody had mentioned method modify.
With Respect,
Matt DeLacey
 
ruilin yang
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matt,
The modify method saves a record to the database. However, in order to meaningfully record the booking information, the modify is mot enough. For example, traveler's name, travelling date, etc need to be saved. The Database schema need to be changed to save the book inf.
Comments please,
Ruilin
 
Matt DeLacey
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whoa, Nellie!
We're in two different worlds. I see what you are saying, but that is WAY beyond the scope of this project. But I'm sure you know that. Have fun.
Matt
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic