public class HospitalEmployee { protected String name; protected int number; //---- // Sets up this hospital employee with the specified information. //------ public Hospital Employee (String empName, int empNumber) { name = empName; number empNumber; } //- // Sets the name for this employee. //------ public void setName (String empName) { name = empName; } //- // Sets the employee number for this employee. //------ public void setNumber (int empNumber) { number empNumber; } //-- // Returns this employee's name. //----- public String getName() { return name; } //- // Returns this employee's number. // public int getNumber () { return number; } //-- // Returns a description of this employee as a string. //----- public String toString() { } return name + "\t" + number;
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Design and implement a set of classes that define the employees
of a hospital: doctor, nurse, administrator, surgeon, receptionist,
janitor, and so on. Include methods in each class that are named
according to the services provided by that person and that print
an appropriate message. Create a main driver class to instantiate
and exercise several of the classes.
Trending now
This is a popular solution!
Step by step
Solved in 6 steps with 4 images