using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

 

namespace Lab2

{

    public class EmployeeTests

    {

        public static void Main(string[] args)

    {

        Employee myEmployee1= new Employee();

        Employee myEmployee2= new Employee();

 

        Console.WriteLine ( "Enter first name" );

        myEmployee1.FirstName = Console.ReadLine();

        Console.WriteLine();

 

        Console.WriteLine("Enter Last Name ");

        myEmployee1.LastName = Console.ReadLine();

        Console.WriteLine();

 

        Console.WriteLine("Enter Monthly Salary ");

        myEmployee1.MonthlySalary =Convert.ToDecimal(Console.ReadLine());

        Console.WriteLine();

        // need to give each person ten percent raise

        Console.WriteLine("Employee: " + myEmployee1.FirstName + myEmployee1.LastName);

        Console.WriteLine("Salary is "+ myEmployee1.MonthlySalary);

        Console.WriteLine("Employee gets 10% raise");

        myEmployee1.MonthlySalary = myEmployee1.MonthlySalary * 1.10M;

        Console.WriteLine("Employee: " + myEmployee1.FirstName + myEmployee1.LastName);

        Console.WriteLine("New Salary is " + myEmployee1.MonthlySalary);

       

        //myEmployee1.MonthlySalary; 

        Console.WriteLine();

 

         Console.WriteLine("Enter first name");

        myEmployee2.FirstName = Console.ReadLine();

        Console.WriteLine();

 

        Console.WriteLine("Enter Last Name ");

        myEmployee2.LastName = Console.ReadLine();

        Console.WriteLine();

 

        Console.WriteLine("Enter Monthly Salary ");

        myEmployee2.MonthlySalary = Convert.ToDecimal(Console.ReadLine());

        Console.WriteLine();

        // need to give each person ten percent raise

        Console.WriteLine("Employee: " + myEmployee2.FirstName + myEmployee2.LastName);

        Console.WriteLine("Salary is " + myEmployee2.MonthlySalary);

        Console.WriteLine("Employee gets 10% raise");

        myEmployee2.MonthlySalary = myEmployee2.MonthlySalary * 1.10M;

        Console.WriteLine("Employee: " + myEmployee2.FirstName + myEmployee2.LastName);

        Console.WriteLine("New Salary is " + myEmployee2.MonthlySalary);

 

        Console.ReadLine();

    }

}

}

 

 

    

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

 

namespace Lab2

{

    class Employee

    {

        private String firstName;

        private String lastName;

        private decimal monthlySalary;

 

        public String FirstName

        {

            get

            {

                return firstName;

            }

            set

            {

                firstName = value;

            }

 

        }

 

        public String LastName

        {

            get

            {

                return lastName;

            }

            set

            {

                lastName = value;

            }

        }

 

        public decimal MonthlySalary

        {

            get

            {

                return monthlySalary;

            }

            set

            {

                if (value >= 0)

                    monthlySalary = value;

            }

        }

      

    }

}

 

Homepage