Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

More Books

Students also viewed these Databases questions