
class Employee {

	//-- properties --
	protected String name;

	//-- constructors --
	public Employee() {
		name = new String("John Doe");
	}

	public Employee( String name ) {
		this.name = name;
	}

	//-- accessors --
	public String getName() {
		return name;
	}

	public void setName( String name ) {
		this.name = name;
	}

	//-- behaviors --
	public String toString() {
		return "Name = " + name + "\n";
	}
}

class SalariedEmployee extends Employee {

	//-- properties --
	private double salary;
	private double bonusPercentage;

	//-- constructors --
	public SalariedEmployee()
	{	super();
		salary = 60000.0;
		bonusPercentage = 0.25;
	}

	public SalariedEmployee( double salary )
	{	super();
		this.salary = salary;
	}

	public SalariedEmployee( String name, double salary, double bonus )
	{	super( name );
		this.salary = salary;
		this.bonusPercentage = bonus;
	}

	//-- accessors --
	public double getSalary() {
		return salary;
	}

	public void setSalary( double salary ) {
		this.salary = salary;
	}

	public double getBonusPercentage() {
		return bonusPercentage;
	}

	public void setBonusPercentage( double bonus ) {
		this.bonusPercentage = bonus;
	}

	//-- behaviors --
	public String toString() {
		return super.toString() 
			+ "Salary = " + salary 
			+ "Bonus Percentage = " + bonusPercentage;
	}

	public double weeklySalary() {
		return salary / 52.0;
	}

	public double bonus() {
		return salary * bonusPercentage;
	}
}

class HourlyEmployee extends Employee {

	//-- properties --
	private double hourlyRate;
	private int hourWorked;

	//-- constructors --
	public HourlyEmployee()
	{	super();
		hourlyRate = 7.0;
		hourWorked = 40;
	}

	public HourlyEmployee( double hourlyRate, int hourWorked )
	{	super();
		this.hourlyRate = hourlyRate;
		this.hourWorked = hourWorked;
	}

	public HourlyEmployee( String name, double hourlyRate, int hourWorked )
	{	super( name );
		this.hourlyRate = hourlyRate;
		this.hourWorked = hourWorked;
	}

	//-- accessors --
	public double getHourlyRate() {
		return hourlyRate;
	}

	public void setHourlyRate( double hourlyRate ) {
		this.hourlyRate = hourlyRate;
	}

	public int getHourWorked() {
		return hourWorked;
	}

	public void setHourWorked( int hourWorked ) {
		this.hourWorked = hourWorked;
	}

	//-- behaviors --
	public String toString() {
		return super.toString() +
			"HourlyRate = " + hourlyRate +
			"HourWorked = " + hourWorked + "\n";
	}

	public double bonus()
	{	if( hourWorked <= 40 )
			return 0.0;

		int extra = hourWorked - 40;
		return extra * hourlyRate * 1.5;
	}

	public double weeklySalary()
	{	if( hourWorked > 40 )
			return 40 * hourlyRate + bonus();
		else
			return hourWorked * hourlyRate;
	}

}

class Driver
{


}

