class Animal {
	private String _name;
	private String _sound;
	public Animal(String name, String sound) {
		_name = name; _sound = sound; }
	public String getName() { return _name; }
	public void makeSound() {
		System.out.println(_name + " goes " + _sound); }
}

class Flyer extends Animal {
	protected boolean _isFlying; // Error 1: Shadowed variables removed
	public Flyer(String name, String sound) { super(name, sound); }
	public void makeSound() { // Error 3: Superclass constructor call
		if (_isFlying)
			System.out.println(getName() + " goes flap");
		else super.makeSound();
	}
	public void fly() { _isFlying = true; }
	public void stop() { _isFlying = false; }
}

class Glider extends Flyer {
	private boolean _isGliding;
	public Glider(String name, String sound) { super(name, sound); }
	public void glide() { if (_isFlying) _isGliding = true; }
	public void stop() { _isFlying = false; _isGliding = false; }
	public void makeSound() {
		if (_isGliding) 
			System.out.println(getName() + " goes whoosh");
		else super.makeSound(); // Error 2: Superclass method call
	}
}

public class TestFlyer {
	public static void main(String[] args) {
		
		// 7 test cases
		Animal cow = new Animal("Cow", "Moo");
		cow.makeSound(); // Moo
		
		Flyer tweety = new Flyer("Bird", "Tweet");
		tweety.makeSound(); // Tweet
		
		Flyer pidgeot = new Flyer("Bird", "Chirp");
		pidgeot.fly();
		pidgeot.makeSound(); // flap
		
		Glider sleepingBat = new Glider("Bat", "...");
		sleepingBat.makeSound(); // ...
		
		Glider flyingBat = new Glider("Bat", "Ping~!");
		flyingBat.fly();
		flyingBat.makeSound(); // flap
		
		Glider codingBat = new Glider("Bat", "Ping~!");
		codingBat.glide();
		codingBat.makeSound(); // Ping~!
		
		Glider glidingBat = new Glider("Bat", "Ping~!");
		glidingBat.fly();
		glidingBat.glide();
		glidingBat.makeSound(); // whoosh
	}
}
