Staff Class
import java.util.Scanner;
class Staff{
int staffId, Phone;
String Name;
float Salary;
}
class Teaching extends Staff{
String domain;
int publications;
void dispa(){
System.out.printf("%d\t%d\t%s\t%f\t%s\t%d\t", staffId, Phone,
Name, Salary, domain, publications);
}
}
class Technical extends Staff{
int skills;
void dispb(){
System.out.printf("%d\t", skills);
}
}
class Contract extends Staff{
int period;
void dispc(){
System.out.printf("%d\n", period);
}
}
public class fifteen {
public static void main(String[] args) {
int n =3, i;
Scanner s = new Scanner(System.in);
Teaching A[] = new Teaching[n];
Technical B[] = new Technical[n];
Contract C[] = new Contract[n];
for(i=0;i< n;i++){
A[i] = new Teaching();
B[i] = new Technical();
C[i] = new Contract();
System.out.println("enter details:");
A[i].staffId=s.nextInt();
A[i].Name=s.next();
A[i].Salary=s.nextFloat();
A[i].Phone=s.nextInt();
A[i].domain=s.nextLine();
A[i].publications=s.nextInt();
B[i].skills=s.nextInt();
C[i].period=s.nextInt();
}
System.out.println("blahblah\n");
for(i=0;i < n;i++){
A[i].dispa();
B[i].dispb();
C[i].dispc();
}