Thursday, November 20, 2014

class TestEmployee and Employee to calculate totalPay

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyFirstConsoleApp.day2.examples
{
    class TestEmployee
    {
        static void Main()
        {
            Employee alex = new Employee();
            Employee lynda = new Employee();

            alex.salary = 90000;
            alex.bonus = 20000;
            alex.CalculateTotalPay();

            lynda.salary = 100000;
            lynda.bonus = 20000;
            lynda.CalculateTotalPay();

            Console.ReadLine();
        }
    }
}






******************
***************
******************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyFirstConsoleApp.day2.examples
{
    class Employee
    {
        public double salary;
        public double bonus;

        public void CalculateTotalPay() {
            double totalPay = salary + bonus;
            Console.WriteLine("Total Pay= " + totalPay);
        }
    }
}

No comments:

Post a Comment