/*
 * Airplane2.java
 *
 * A blueprint class for representing an airplane.
 *
 * Author: S-111 Course Staff
 */
public class Airplane2 {

    private String manufacturer;
    private int modelNumber;
    private boolean isFlying;
    private int milesFlown;

    public Airplane2(String manufacturer, int num, int miles) {
        this.manufacturer = manufacturer;
        this.modelNumber = num;
        this.milesFlown = miles;

        /*
         * The following isn't strictly necessary, since the default
         * value will be false.
         */
        //this.isFlying = false;
    }

    /*
     * getID - returns the identification of the plane.
     */
    public String getID() {
        return this.manufacturer + " " + this.modelNumber;
    }

    /*
     * isFlying - returns whether the plane is currently in flight.
     */
    public boolean isFlying() {
        return this.isFlying;
    }

    /*
     * getMilesFlown - returns the number of miles flown by this plane.
     */
    public int getMilesFlown() {
        return this.milesFlown;
    }

    /*
     * changeFlightStatus - changes the flight status of the plane.
     */
    public void changeFlightStatus() {
        this.isFlying = !this.isFlying;
    }

    /*
     * addMilesFlown - adds miles flown to the running count for this plane.
     */
    public void addMilesFlown(int miles) {
        if (miles < 0) {
            throw new IllegalArgumentException("cannot add negative miles");
        }

        this.milesFlown += miles;
    }
}
