Question: JAVA - Type the program's output import java.util.ArrayList; public class CallEmployee { public static void main ( String [ ] args ) { Employee person
JAVA
Type the program's output
import java.util.ArrayList;
public class CallEmployee
public static void mainString args
Employee person;
Nurse person;
Coach person;
ArrayList personList new ArrayList;
int i;
person new Employee;
personsetNameMia;
person new Nurse;
personsetNameAja;
personsetHospitalCity Hospital";
person new Coach;
personsetNameJose;
personsetSportbasketball;
personList.addperson;
personList.addperson;
personList.addperson;
fori ; i personList.size; i
personList.getiprintInfo;
public class Employee
protected String name;
public void setNameString setName
name setName;
public void printInfo
System.out.printlnname;
public class Nurse extends Employee
private String hospital;
public void setHospitalString setHospital
hospital setHospital;
@Override
public void printInfo
System.out.printlnname works at hospital;
public class Coach extends Employee
private String sport;
public void setSportString setSport
sport setSport;
@Override
public void printInfo
System.out.printlnname coaches sport;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
