Project #46238 - java HW

Doctor

 

Objective: 

Define a class named Doctor whose objects are records for a clinic’s doctors.  Derive the class from the class Person. A Doctor record has the doctor’s name – defined in the class Person – a specialty (such as Pediatrician, Obstetrician, etc.), and an office visit fee (use double).  Give your class a set of accessors, mutators (with error checking), constructors, and an equals method. 

 

Write a separate driver class that tests ALL the methods.  This doesn’t require any input from the user, as it simply goes through and tests all the methods such as the accessors, mutators,

 

 

Example Dialog:

 

Testing the Doctor Class

Creating Doctor via default constructor

Printing Doctor’s Information.

Name: No Name Yet.

Specialty: None

Fee: $0

 

Changing default Doctor’s name, specialty, and fee via mutators.

Printing Doctor’s Information.

Name: Tom Baker

Specialty: Time Lord

Fee: $4.95

 

Creating Doctor via parameterized constructor

Printing Doctor’s Information.

Name: Albert W. Wiley

Specialty: Robotics

Fee: $1987

 

Testing if the two doctors are equal.

False

 

Done!

 

 

class Person.

 

 

public class Person
{
    private String name;
    
    public Person( )
    {
        name = "No name yet";
    }
    
    public Person(String initialName)
    {
        name = initialName;
    }
    
    public void setName(String newName)
    {
        name = newName;
    }
    
    public String getName( )
    {
        return name;
    }
    
    public void writeOutput( )
    {
        System.out.println("Name: " + name);
    }
   
    public boolean hasSameName(Person otherPerson)
    {
        return this.name.equalsIgnoreCase(otherPerson.name);
    }
}

 

Subject Computer
Due By (Pacific Time) 11/04/2014 11:30 pm
Report DMCA
TutorRating
pallavi

Chat Now!

out of 1971 reviews
More..
amosmm

Chat Now!

out of 766 reviews
More..
PhyzKyd

Chat Now!

out of 1164 reviews
More..
rajdeep77

Chat Now!

out of 721 reviews
More..
sctys

Chat Now!

out of 1600 reviews
More..
sharadgreen

Chat Now!

out of 770 reviews
More..
topnotcher

Chat Now!

out of 766 reviews
More..
XXXIAO

Chat Now!

out of 680 reviews
More..
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy