/* This class describes a vehicle with the following attributes and methods! */

import java.util.ArrayList;

public class Vehicle extends Product {

	private String regNbr;
	private String model; 
	private String type; // What kind of vehicle...
	private String licenseReq; // What license is required to drive it...
	private int price; // Rental price per day...
	private String info; // General information about the vehicle
	private boolean hasHook; // If the vehicle is able to pull lorries...
	private String expiryDate; // When it should be sold!
	private Warehouse warehouse; // Where the vehicle is located!
	private ArrayList<String> datesBooked; // A list containing dates when it's booked...

	public Vehicle(String regNbr, String model, String type, String licenseReq,
				   int price, String info, boolean hasHook, 
				   String expiryDate, Warehouse warehouse) {
		
		this.regNbr = regNbr;
		this.model = model;
		this.type = type;
		this.licenseReq = licenseReq;
		this.price = price;
		this.info = info;
		this.hasHook = hasHook;
		this.expiryDate = expiryDate;
		this.warehouse = warehouse;
		this.datesBooked = new ArrayList<String>();
	}

	public String getRegNbr() {
		return regNbr;
	}

	public void setRegNbr(String regNbr) {
		this.regNbr = regNbr;
	}

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getLicenseReq() {
		return licenseReq;
	}

	public void setLicenseReq(String licenseReq) {
		this.licenseReq = licenseReq;
	}

	public int getPrice() {
		return price;
	}

	public void setPrice(int price) {
		this.price = price;
	}

	public String getInfo() {
		return info;
	}

	public void setInfo(String info) {
		this.info = info;
	}

	public boolean isHasHook() {
		return hasHook;
	}

	public void setHasHook(boolean hasHook) {
		this.hasHook = hasHook;
	}

	public String getExpiryDate(){
		return expiryDate;
	}

	public void setExpiryDate(String expiryDate){
		this.expiryDate = expiryDate;
	}
	
	public Warehouse getWarehouse(){
		return warehouse;
	}

	public void setWarehouse(Warehouse warehouse){
		this.warehouse = warehouse;
	}
	
	public boolean isBookable(String date) { // Method to check if a car is bookable!
		for(int a = 0; a < datesBooked.size(); a++) { // Checks the whole list...
		
			if(datesBooked.get(a).equals(date)) { // If there is a date which matches our date...
				return false; // ... it's not available for booking!
			}
		} 
		datesBooked.add(date); // Since there is no date, add it and...
		return true; // ... make it available for booking! 
	}
}

@@ -1864,11 +1864,9 @@
 ean 
-isH
+h
 asHo
@@ -2283,17 +2283,24 @@
 (String 
-d
+enteredD
 ate) %7B /
@@ -2339,16 +2339,19 @@
 okable!%0A
+%09%09%0A
 %09%09for(in
@@ -2453,17 +2453,24 @@
 .equals(
-d
+enteredD
 ate)) %7B 
@@ -2583,132 +2583,238 @@
 %09%09%7D%0A
+%09%09%09%0A
 %09%09%7D %0A%09%09
-datesBooked.add(date); // Since there is no date, add it and...%0A%09%09return true; // ... make it available for booking! 
+return true; // ... make it available for booking!%0A%09%7D%0A%09%0A%09public void setBooked(String enteredDate) %7B%0A%09%09datesBooked.add(enteredDate);%0A%09%7D%0A%0A%09public void removeBooked(String enteredDate) %7B%0A%09%09datesBooked.remove(enteredDate);
 %0A%09%7D%0A

Update Vehicle.java