computer science
Answers
// Employee class public class Employee { // Instance variables public string FirstName { get; set; } public string LastName { get; set; } private decimal monthlySalary; // Constructor public Employee(string firstName, string lastName, decimal monthlySalary) { FirstName = firstName; LastName = lastName; if (monthlySalary >= 0) this.monthlySalary = monthlySalary; } // Property for monthly salary public decimal MonthlySalary { get { return monthlySalary; } set { if (value >= 0) monthlySalary = value; } } } // Main test application class EmployeeTest { static void Main() { Employee e1 = new Employee("John", "Smith", 3000); Employee e2 = new Employee("Sara", "Brown", 4000); // Display each employee's yearly salary decimal e1Yearly = e1.Monthly