public string Name { get; set; }
public int Age { get; set; }
public string Address{get; set;}
public Person(string Name, int Age, string Address){
public virtual void DisplayInfo()
Console.WriteLine($"Name: {Name}, Age: {Age}");
public int GradeLevel { get; set; }
public Student(string Name, int Age,string Address, int GradeLevel) : base(Name, Age,Address)
this.GradeLevel = GradeLevel;
Console.WriteLine($"{Name} is studying.");
public override void DisplayInfo()
Console.WriteLine($"Grade Level: {GradeLevel}");
public interface EmployeeDetails{
void WorkingTenureInMonths(int months);
void SalaryDetails(int amount);
class Teacher : Person, EmployeeDetails
public string Subject { get; set; }
public int YearsOfExperience{get; set;}
public Teacher(string Name, int Age,string Address, string Subject): base(Name,Age,Address){
Console.WriteLine($"{Name} is teaching {Subject}.");
public void WorkingTenureInMonths(int months)
int remainingMonths = months % 12;
Console.Write($"The working tenure of {Name} is {years} year");
Console.Write($" and {remainingMonths} month");
Console.WriteLine($"The working tenure is {months} month");
Console.WriteLine($"Invalid input for months.");
public void SalaryDetails(int amount){
Console.WriteLine($"The salary of {Name} is {amount}");
Student student1 = new Student("Delish",22,"USA",14);
Teacher teacher1 = new Teacher("Mr. Smith",35,"Toronto","Maths");
teacher1.WorkingTenureInMonths(26);