---
# System prepended metadata

title: Lab5-1

---

1. Create a class called Employee that includes three pieces of information as
data members — a **first name** (type string), a **last name** (type string) and a **monthly salary**(type int). 

- Your class should have a **constructor** that initializes the three data members.
- Provide **a set and a get function** for each data member.

- For constructor and set function of salary member, **if the monthly salary is not positive, set it to 0**.
- - -
### **Write a test program that demonstrates class Employee’s capabilities**.

- Use constructor to create two Employee objects(one with salary > 0, and the other with salary < 0) and display each object’s **yearly salary** (monthly salary $\times$ 12)
    - **Test Code Example**
        ```charp
        Employee a = new Employee("Alice", "Chen", 5000);
        Employee b = new Employee("Bob", "Lin", -1000);
        Console.WriteLine(12 * a.getSalary());
        Console.WriteLine(12 * b.getSalary());
        ```



