This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Create the DiscountRoom class for Hotel Rooms

 
Richard Jackson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,all
I created a DiscountRoom class for present Hotel Rooms,

This is only my assumption ways to create database records.
1.I prepare to add toString() method to return specified record.
2.Do I have to add DiscountRoom getDiscountRoom(String criteria) method to return a room object when I want to search name and/or location record?
Regards,
Richard
 
Richard Jackson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,all
The DiscountRoom is equal to a class called "Record"( or FieldInfo),leastwise I think so.
Welcome to give some advice to make it perfectly.
If possible,do you think what things it need yet?
Regards,
Richard
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Richard,
The code you have provided looks reasonable.
In the no argument constructor, what would be the values of the class variables if you did not explicitly set them?
1.I prepare to add toString() method to return specified record.

That is up to you - do you have any cases where you will want to have a String representation of the object?
2.Do I have to add DiscountRoom getDiscountRoom(String criteria) method to return a room object when I want to search name and/or location record?

That sounds reasonable - I assume your addDiscountRoom() would take an instance of the DiscountRoom class as a parameter and then it would call the necessary methods in the Data class to do the real addition. Likewise the getDiscountRoom() method would call the necessary methods in the Data class to get the room or rooms and then return a DiscountRoom array for the results.
If possible,do you think what things it need yet?

You might also want a way of getting the schema (but then again you might not). Design decision time
Regards, Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic