Java Reference
In-Depth Information
public void printCheck()
{
System.out.println("Printing check for regular employee");
}
}
//******************************************
//******************************************
// CLASS PartTimer
//******************************************
//******************************************
class PartTimer extends Employee
{
//********************************
// attributes section
//********************************
private double hourlyWage;
private int hoursWorked;
//*********************************
// methods section
//*********************************
// Constructor
public PartTimer(String n, String a, String s,
int x, double wage, int hours)
{
// Call the constructor in the superclass
super(n, a, s, x);
// Initialize specific fields
this.hourlyWage = wage;
this.hoursWorked = hours;
}
public void printCheck()
{
System.out.println("Printing check for part-timer");
}
}
//******************************************
//******************************************
// Driving class
//******************************************
//******************************************
public class SimpleInherit
{
public static void main(String[] args)
{
// First two objects of Employee class are created using the
// parameterized constructor
Employee emp1 = new Employee("Jane", "131 Calm Street",
"263", 2);
Employee emp2 = new Employee("Jim", "42 Curve Road",
Search WWH ::




Custom Search