import java.util.Scanner;

public class Furniture implements SaleItem, ShippedItem{
    private int ID;
    private double price;
    private double weightKg;
    private double width;
    private double height;
    private double distanceToShip;
    private boolean purchased;
    private boolean canShip, shipped;

    private static Scanner in = new Scanner(System.in);

    public Furniture(int id, double price, double weightKg, 
		     double width, double height) {
	ID = id;
	this.price = price;
	this.weightKg = weightKg;
	this.width = width;
	this.height = height;
	purchased = shipped = false;
	canShip = true; //okay to ship by default
	distanceToShip = 0;
    }
    public int getID() {return ID; }
    public double getPrice() {return price;}
    public double getWidth() {return width;}
    public double getHeight() {return height;}
    public double getDistance() {return distanceToShip;}
    public boolean getPurchased() {return purchased;}
    public boolean getShipped() {return shipped;}
    public boolean canShip() {return canShip; }
    //no mutators b/c none of the above ever change

    //implement SaleItem
    //getPrice() already implemented above (note this was natural)
    public void purchase() {
	purchased = true;
	//check if we need to ship 
	distanceToShip = inputDistance();
	if(distanceToShip <= MAX_DISTANCE) {
	    shipped = true;
	}
	else {
	    canShip = false;
	    shipped = false;
	}
    }

    public boolean purchased() {
	return getPurchased();
    }
    //helper method 
    private static double inputDistance() {
	double input = 0;
	System.out.println("Enter miles to your address: ");
	//assume valid input
	input = in.nextInt();	
	return input;
    }

    //implement shippedItem
    //getDistance() already implemented in the accessors
    public boolean shipped() {
	return getShipped();
    }
}
