Nurse - { return (salary/26D)*.80D; } public Object clone()...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.lang.*; public class Nurse implements Employable, Comparable, Cloneable { private double salary; private String name; private int SSN; Doctor[] knownDocs; public Nurse(){ this(0, "",0, new Doctor[0]); } public Nurse(String name, int SSN) { this(0, name, SSN, new Doctor[0]); } public Nurse(double salary, String name, int SSN, Doctor[] knownDocs){ setSalary(salary); setName(name); setSSN(SSN); setKnownDocs(knownDocs); } public double getSalary(){ return salary; } public void setSalary(double salary){ this.salary = salary; } public String getName(){ return name; } public void setName(String name){ = name; } public int getSSN(){ return SSN; } public void setSSN(int SSN){ this.SSN = SSN; } public Doctor[] getKnownDocs(){ return knownDocs; } public void setKnownDocs(Doctor[] knownDocs){ this.knownDocs = knownDocs; } public double getBiWeeklyPay()
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { return (salary/26D)*.80D; } public Object clone() { Doctor doc = new Doctor[knownDocs.length]; Nurse nurse; try { nurse = (Nurse)super.clone(); for(int i=0; i<doc.length; i++) { if (knownDocs[i] == null) { doc[i] = null; } else doc[i] = (Doctor)knownDocs[i].clone(); } nurse.setSSN(SSN); nurse.setName(name); nurse.setSalary(salary); nurse.setKnownDocs(doc); n return nurse; } catch (CloneNotSupportedException ex) { return null; } } public int compareTo(Object o) { if (o instanceof Nurse) { Nurse nurse = (Nurse)o; if (getSSN() == nurse.getSSN()) { if (getName().equals(nurse.getName())) { return 0; r } else return getName().compareTo(nurse.getName()); } else return getSSN() >= nurse.getSSN() ? 1 : -1; } return -1; } }...
View Full Document

This note was uploaded on 03/25/2010 for the course CIS CIS3023 taught by Professor Seema during the Spring '10 term at Florida College.

Page1 / 2

Nurse - { return (salary/26D)*.80D; } public Object clone()...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online