lab task 4
lab task 4
Based on their role they have separate job responsibilities. The company
calculate the salary of their employees. But the calculation formula for
Employee is different for different types of role.
using System;
namespace ABCCompany
Name = name;
BaseSalary = baseSalary;
// Manager class
: base(name, baseSalary)
BonusPercentage = bonusPercentage;
PerformanceIncentives = performanceIncentives;
// Programmer class
: base(name, baseSalary)
SkillLevelMultiplier = skillLevelMultiplier;
ProjectBonus = projectBonus;
}
public override decimal CalculateSalary()
class Program
// Create a Manager
// Create a Programmer
2. Different Animal behaves differently. The communication is also different for each of them.
We know Dog will bark, similarly, cow will moo, cat will meow. Though all of them are
animals they will behave differently.
using System;
namespace AnimalBehavior
return "Woof!";
}
// Cat class inheriting from Animal
return "Meow!";
return "Moo!";
}
// Main program
class Program
// Array of animals
// Loop through each animal and display their communication and behavior
Console.WriteLine(animal.Behavior());
Console.WriteLine();
Console.ReadKey();