3 import java.io.Serializable;
7 @SuppressWarnings("serial")
8 public class Offer implements Serializable {
11 private int offerNumber;
12 private Date firstDay; // Dates are stored as java.util.Date objects instead of java.sql.Date objects
13 private Date lastDay; // because, they are not well stored in db4o as java.util.Date objects
14 private float price; // This is coherent because objects of java.sql.Date are objects of java.util.Date
15 private Booking booking; // That is: java.sql.Date is a subclass (or extends) java.util.Date
16 private RuralHouse ruralHouse;
19 public Offer(int offerNumber,RuralHouse ruralHouse, Date firstDay, Date lastDay, float price){
20 this.firstDay=firstDay;
23 this.ruralHouse=ruralHouse;
24 this.offerNumber=offerNumber;
27 * Get the house number of the offer
29 * @return the house number
31 public RuralHouse getRuralHouse() {
32 return this.ruralHouse;
36 * Set the house number to a offer
40 public void setRuralHouse(RuralHouse ruralHouse) {
41 this.ruralHouse = ruralHouse;
46 * Get the offer number
48 * @return offer number
50 public int getOfferNumber() {
51 return this.offerNumber;
57 * Get the first day of the offer
59 * @return the first day
61 public Date getFirstDay() {
66 * Set the first day of the offer
71 public void setFirstDay(Date firstDay) {
72 this.firstDay = firstDay;
76 * Get the last day of the offer
78 * @return the last day
80 public Date getLastDay() {
85 * Set the last day of the offer
90 public void setLastDay(Date lastDay) {
91 this.lastDay = lastDay;
99 public float getPrice() {
108 public void setPrice(float price) {
113 * Get the book number
115 * @return book object
117 public Booking getBooking() {
122 * Set the book object
128 public void setBooking(Booking booking) {
129 this.booking = booking;
133 * This method creates a book with a corresponding parameters
135 * @param First day, last day, house number and telephone
138 public Booking createBooking(int numBooking,String bookTelephoneNumber) {
139 return booking=new Booking(numBooking,bookTelephoneNumber,this);
143 public String toString(){
144 return firstDay.toString()+", "+lastDay.toString()+", "+price;