Java_CH_10_exercise_864a2b12-0200-4215-8bed-7c130c8ccd03
Java_CH_10_exercise_864a2b12-0200-4215-8bed-7c130c8ccd03
1. A company pays its employees on a weekly basis. The employees are of two types:
Salaried employees are paid a fixed weekly salary, hourly employees are paid by the hour and
receive overtime pay (i.e., 1.5 times their hourly salary rate) for all hours worked in excess of
40 hours. Write an application that performs its payroll calculations polymorphically.
//Employee.java
public abstract class Employee {
public String firstName;
public String lastName;
2. Write a program that demonstrate the use of interfaces for different animals. Create three
interfaces: Walkable, Swimmable and Flyable. Each interface should declare a method that
describe the animal’s ability. Create two animal classes that implement any or all of these
interfaces and display the result.
}
Output:
Animals That Can Walk:
Duck can walk by using its legs.