Da Moe Employe
Da Moe Employe
Da Moe Employe
cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace class_work
{
class DemoEmploye
{
static void Main(string[] args)
{
RegularEmployee E1 = new RegularEmployee();
RegularEmployee E2 = new RegularEmployee(1,"shakeel,","Bahawalpur",40000,3000,5000);
CommissionEmployee C1 = new CommissionEmployee();
CommissionEmployee C2 = new CommissionEmployee(1, "shakeel", "Bahawalpur", 40000, 500);
Console.WriteLine("E1 objects;" + E1.ToString());
Console.WriteLine("E2 objects;" + E2.ToString());
Console.WriteLine("E1==E2" + E1.Equals(E2));
Console.WriteLine("Earning"+ E1.Earning());
Console.WriteLine("Earning" + E2.Earning());
Console.WriteLine("C1 objects;" + C1.ToString());
Console.WriteLine("C2 objects;" + C2.ToString());
Console.WriteLine("C1==C2" + C1.Equals(C2));
Console.WriteLine("Earning" + C1.Earning());
Console.WriteLine("Earning" + C2.Earning());
E1.EmpId = 12;
E1.Empname = "shakeel";
E1.Empadd = "bwp ";
E1.BasicSalary = 50000;
E1.HouseRentAllowance = 2000;
E1.MedicalAllowance = 2000;
C1.CommissionRate = 1000;
C1.TotalSales = 100;
Console.ReadKey();
}
}
}
Employe.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace class_work
{
}
public override bool Equals(object obj)
{
Employee E = obj as Employee;
if (empId == E.empId)
return true;
else return false;
}
public abstract double Earnings();
}
}
RegularEmployee.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace class_work
{
class RegularEmployee:Employee
{
private double basicSalary;
private double medicalAllowance;
private double houseRentAllowance;
public RegularEmployee() : base()
{
basicSalary = 0;
medicalAllowance = 0;
houseRentAllowance = 0;
}
public RegularEmployee(int eid, string ename, string eadd, double bs, double ma, double hra) : base(eid, ename, eadd)
{
basicSalary = bs;
medicalAllowance = ma;
houseRentAllowance = hra;
}
public double BasicSalary
{
set { basicSalary = value; }
get { return basicSalary; }
}
public double MedicalAllowance
{
set { medicalAllowance = value; }
get { return medicalAllowance; }
}
public double HouseRentAllowance
{
set { houseRentAllowance = value; }
get { return houseRentAllowance; }
}
public override string ToString()
{
return base.ToString() + "basicSalary:" + basicSalary + "medicalAllowance:" + medicalAllowance + "houseAllowance:" +
houseRentAllowance;
}
public override double Earnings()
{ return basicSalary = medicalAllowance / 100 * basicSalary + houseRentAllowance / 100 * basicSalary; }
}
}
CommissionEmployee.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace class_work
{
class CommissionEmployee : Employee
{
}
public CommissionEmployee(int eid, string ename, string eadd, double sales , double commission) :base( eid, ename, eadd)
{
totalSales = sales;
commissionRate = commission;
}
public double TotalSales
{
set { totalSales = value; }
get { return totalSales; }
}
public double CommissionRate
{
set { commissionRate = value; }
get { return commissionRate; }
}
}
}
Calculater.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Media;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace calculater
{
public partial class Form1 : Form
{
bool dotpressed = false;
double var1 = 0;
string arthoperation;
bool operaterpressed=false;
public Form1()
{
InitializeComponent();
}
}
}
}
Notepad
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp12
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}
}
namespace DemoPoint
{
class DemoPoint
{
static void Main(string[] args)
{
Point P1 = new Point();
Point P2=new Point(10,20);
Point P3= new Point(20, 30);
Console.WriteLine("P1 object:" + P1.ToString());
Console.WriteLine("P2 object:" + P2.ToString());
P1.SetXCoordinate(25);
P1.SetYCoordinate(35);
Console.WriteLine("P1 object:" + P1.ToString());
Console.WriteLine("P1 object: xCoordinate:" + P1.getXCoordinate();
Console.WriteLine("P1==p2 : " + P1.Equals(P2));
}
}
Point.css
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DemoPoint
{
class Point
{
private int xCoordinate;
private int yCoordinate;
public Point()
{
xCoordinate=0;
yCoordinate =0;
}
public Point(int xCoordinate, int yCoordinate) {
this.xCoordinate= xCoordinate;
this.yCoordinate= yCoordinate;
}
public void SetXCoordinate(int xCoordinate)
{
this.xCoordinate = xCoordinate;
}
public int getXCoordinate()
{
return xCoordinate;
}
public void setYCoordinate(int xCoordinate) {
this.yCoordinate= xCoordinate;
}
public int getYCoordinate()
{
return yCoordinate ;
}
public override string ToString()
{
return "XCoordinate:"+ xCoordinate +",yCoordinate:" + yCoordinate;
}
public override bool.Equal(Point P)
{
if (this.xCoordinate == P.xCoordinate & this.yCoordinate == P.yCoordinate)
{
return true;
}
else {
return false;
}
}
}
}