1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
algol13
3 years ago
14

Define a class named Doctor whose objects are records for a clinic’s doctors. Derive this class from the class Person given in L

esson. A Doctor record has the doctor’s name—defined in the class Person—a specialty as a string (for example Pediatrician, Obstetrician, General Practitioner, and so on), and an office-visit fee (use the type double). Give your class a reasonable complement of constructors and accessor methods. Write a driver program to test all your methods.
Computers and Technology
1 answer:
pashok25 [27]3 years ago
6 0

Answer:

Following is defined the required class having accessor methods and test program:

Explanation:

class Person

{

private String doc_name;

public Person(String doc_name)

{

this.doc_name = doc_name;

}

public String getDoc_Name()

{

return doc_name;

}

}

class Doctor extends Person

{

private double office_visit_fee;

private String Specialty;

public Doctor(String doc_name,double office_visit_fee,String Specialty)

{

super(doc_name);

this.office_visit_fee = office_visit_fee;

this.Specialty = Specialty;

}

//accessor methods

public double getOffice_Visit_Fee()

{

return office_visit_fee;

}

public String getSpecialty()

{

return Specialty;

}

public String toString()

{

return "Doctor Name "+getDoc_Name()+" Office Visit Fee :$"+office_visit_fee+

" Specialty : "+Specialty;

}

}

class Test

{

public static void main (String[] args)

{

 Doctor dctr = new Doctor("Joseph Lister",134.56,"Obstetrician");

 System.out.println(dctr);

}

}

Output:

Doctor Name Joseph Lister Office Visit Fee :$134.56 Speciality : Obstetrician

You might be interested in
Let f and g be two one-argument functions. The composition f after g is defined to be the function x 7→ f (g (x)). Define a proc
Ghella [55]

Answer and Explanation:

(define (compose f g)

(lambda (x) (f (g x))))

6 0
3 years ago
Which command compiles the java source code file welcome.java?
shutvik [7]
"javac <FILE NAME>" (unsurprisingly, stands for "java compile"), will compile your java source code in to a .java file, that can be run with the "java <FILE NAME>" command.

Make sure that your command prompt is set to the right destination when you run these commands, using "cd <DESTINATION>", otherwise they may be unable to find them in the incorrect destination.
3 0
4 years ago
The qwerty keyboard is the most common layout of keys on a keyboard.
vagabundo [1.1K]
The qwerty keyboard is the most common keyboard.
6 0
4 years ago
Read 2 more answers
Please help!!!!<br> Data means only facts. <br> A. TRUE B. FALSE
vredina [299]
B false data does not only have to be facts
6 0
3 years ago
If, in a recursive solution, function A calls function B which calls function C, this is called ________ recursion. indirect thr
suter [353]

If, in a recursive solution, function A calls function B which calls function C, this is called<u> Indirect</u> recursion.

A recursive algorithm is said to be recursive if such an algorithm calls itself with smaller input values and get current result for implementing basic operations on those simple inputs.

Indirect recursion occurs when a function A invokes another function B which in turn makes it the original function and calls another function C.

Learn more about recursion here:

brainly.com/question/3169485?referrer=searchResults

6 0
2 years ago
Other questions:
  • Syntax refers to what aspect of language? sounds of words order of words meanings of words
    12·1 answer
  • What's the first step in being a wise consumer of media?
    10·2 answers
  • Which of these techniques will contribute to green computing?
    10·1 answer
  • An effective problem statement ensures that
    12·1 answer
  • Which is the biggest known issue specific to satellite Internet connections?
    13·2 answers
  • What tab should you choose to locate the copy and paste tool?
    10·2 answers
  • Jasmine is writing a shopping app. She has created a variable to keep track of the number of items in the shopping cart. Every t
    6·1 answer
  • Describe how operating system use the following security tools: firewall, automatic updating, antivirus software, spyware and ma
    11·1 answer
  • Assuming even parity, find the parity bit for each of the following data units. a. 1001011 b. 0001100 c. 1000000 d. 1110111
    12·1 answer
  • Line charts are best used for
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!