Professional Documents
Culture Documents
Programming in C# Page 1 of 5
Question 1
I. Create an interface IEmployee that has the following methods:
- double CalculateBonus(string designation, int tenure, double salary):
calculate bonus of employee.
- void DisplayDetails();
1. Fields – private:
2. Fields – protected
3. Fields – public
4. Properties:
• string EmpName – Name of employee: R/W. Length of Name from
6 to 40 characters.
• int YearsOfService – Years of Service of employee: R/W. Value of
YearsOfService from 0 to 60.
Note:
i. R/W: Read-write property.
ii. R: Read property.
iii. W: Write property.
Programming in C# Page 2 of 5
Bonus = salary * 2
if designation is Technician then
if (tenure <= 3) then
Bonus = salary * 0.25
else if (tenure > 3 and tenure <= 5)
Bonus = salary * 0.5
else
Bonus = salary * 2
- Method DisplayDetails(): Display all information of employee and total
income earned is salary + bonus.
1. Methods:
Programming in C# Page 3 of 5
Question 2 : The program demonstrates the use of Constructor and Indexers.
I. Create class Person:
1. Fields – Private:
2. Properties:
Programming in C# Page 4 of 5
-----THE END-----
Programming in C# Page 5 of 5