Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started