• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Create the DiscountRoom class for Hotel Rooms

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic