// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
package booking;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Booking {
    private String hotel;
    private Date start;
    private Date end;
    private DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    public Booking(String hotel, String start, String end) throws ParseException {
        this.hotel = hotel;
        this.start = df.parse(start);
        this.end = df.parse(end);
    }
    public Booking(String hotel, Date start, Date end) {
        this.hotel = hotel;
        this.start = start;
        this.end = end;
    }
    public String getHotel() {
        return hotel;
    }
    public Date getStart() {
        return start;
    }
    public Date getEnd() {
        return end;
    }
    @Override
    public String toString() {
        return String.format("%s : %s - %s", hotel, df.format(start), df.format(end));
    }
}
