// fireman, accountant and teacher inherit from worker

class worker
  {private String first,last;
   private double salary;
   private String jobDescription;

   public worker(String f, String l, double s, String job)
    {first = f;
     last = l;
     salary = s;
     jobDescription = job;
    }

    public String toString()
     {return first+ " " + last+ " " + jobDescription + " " + salary;
     }
   }
   ___________________________________________________________

class accountant extends worker
  {
   public accountant(String f, String l)
    {super(f,l,90000,"Adds numbers");
    }

   }
_____________________________________________

// fireman and teacher are the same as accountant with different
// job description and salary
_______________________________________________________

import java.io.*;
public class inheritmain
{public static input in = new input();

public static void main(String[] args) throws IOException
 {worker [] ar;
  ar = new worker[5];
  ar[0] = new teacher("Jack","Nilan");
  ar[1] = new accountant("Tom","Wetmore");
  ar[2] = new fireman("Bob","Toth");
  ar[3] = new fireman("Dominic","Carfielo");
  ar[4] = new teacher("Bob","Woods");

  for (worker w : ar)
   {System.out.println(w);
}
}
}