package pirates;

public class Pirate {

	private String name;
	private Parrot parrot;
	private int doubloons;
	private int ships;
	
	public Pirate(String name, Parrot parrot, int doubloons, int ships) {
		this.name = name;
		this.parrot = parrot;
		this.doubloons = doubloons;
		if (ships < 0) 
			this.ships = -1 * ships;
		else
			this.ships = ships;
	}

	public Pirate() {
		this.doubloons = 100;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Parrot getParrot() {
		return parrot;
	}

	public void setParrot(Parrot parrot) {
		this.parrot = parrot;
	}

	public int getDoubloons() {
		return doubloons;
	}

	public void setDoubloons(int doubloons) {
		this.doubloons = doubloons;
	}
	
	public int getShips() {
		return ships;
	}

	public void setShips(int ships) {
		this.ships = Math.abs(ships);
		
		// this is the alternate way to do it.
		if (ships < 0) 
			this.ships = -1 * ships;
		else
			this.ships = ships;
	}

	public String getDangerous() {
		String howDangerous;
		switch (this.ships) {
		case 0:
			howDangerous = "not dangerous";
			break;
		case 1:
		case 2:
			howDangerous = "slightly dangerous";
			break;
		default:
			howDangerous = "very dangerous";
		}
		return howDangerous;
	}
	
	public void speak(int timesToSpeak) {
		int i = 0;
		
		while (i < timesToSpeak) {
			System.out.print("Aaaaargh ");
			i++;
		}
	}

	
	
	
}
