Question: C# 1. Create an application named Medicine that instantiates objects of two classes named Doctor and Specialist and that demonstrates all their methods. Create a

 C# 1. Create an application named Medicine that instantiates objects of
C#

1. Create an application named Medicine that instantiates objects of two classes named Doctor and Specialist and that demonstrates all their methods. Create a class named Doctor that includes fields for a name (string), age of practice (int), and salary (double) and properties for each field. Include a protected field for salary and virtual Salary property. The set accessor of the Salary property needs to be written so that no Doctor's salary is ever set to less than 120000. Include a ToString() method that returns a string constructed from the return value of the object's GetType() method and the values of the fields. (5 marks) 2. Extend the Doctor class (from the question 1) with one specialized class Specialist. The class Specialist includes string fields that hold the area of specialization (such as neurologist) and string field that hold date of specialization. Salary for a Specialist increased to a fixed amount of 250000. Subclass Specialist should include a ToString method that overrides the parent class version. (5marks)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!