Write a simple program in which calculate the total amount of items that are sold.

Calculate Total Price after discount.

Program:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ItemCalc
{
class Program
{
static void Main(string[] args)
{

int[] ItemNUM = new int[5];
string[] ITEMName = new string[5];
double[] unitprice = new double[5];
int[] quantiy = new int[5];
double[] price= new double[5];
double discount;
double[] Total = new double[5];
double Sum=0;

for (int i = 0; i < 5; i++)
{
ItemNUM[i] = i + 1;
Console.WriteLine("IITEM {0}",ItemNUM[i]);
Console.WriteLine("Enter ITEM Name");
ITEMName[i] = Console.ReadLine();
Console.WriteLine("Enter unit price");
unitprice[i] = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter Quantity");
quantiy[i] = Convert.ToInt32(Console.ReadLine());
Console.WriteLine();
Total[i] = quantiy[i] * unitprice[i];
Console.WriteLine("Total Price of ITEM:{0} ={1}\n",ItemNUM[i],Total[i]);
Sum = Sum + Total[i];

}
Console.WriteLine("ENter Discount in %");
int disc =Convert.ToInt32( Console.ReadLine());

Console.WriteLine("\nITEM \t ITEM Name\t Unit Price \t Quantity\t Total Price\n");

for(int i=0; i<5;i++)
{
Console.WriteLine("ITEM:{0} \t{1}\t\t{2}\t\t{3}\t\t{4}", ItemNUM[i], ITEMName[i],
unitprice[i], quantiy[i], Total[i]);

}
Console.WriteLine("\nTotal Amount={0}",Sum);
discount = Convert.ToDouble((disc / 100.0) * Sum);
double TotalPrice = Sum - discount;
Console.WriteLine("Amount After discount={0}",TotalPrice);
Console.WriteLine("Please recieve the amount....!!! ");
}
}

}

Output:

Student Class Code
Program:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Student
{
class Student
{
string SName;
String FName;
String Class;
string Section;
int Regno;
String address;
string dob;
string age;
string email;

public void data()
{
Console.WriteLine("Enter Name: ");
SName = Console.ReadLine();
Console.WriteLine("");
Console.WriteLine("Enter Father's Name: ");
FName = Console.ReadLine();
Console.WriteLine("");
Console.WriteLine("Enter Class: ");
Class = Console.ReadLine();
Console.WriteLine("");
Console.WriteLine("Enter Class Section: ");
Section = Console.ReadLine();
Console.WriteLine("");
Console.WriteLine("Enter Registration number: ");
Regno =Convert.ToInt32 (Console.ReadLine());
Console.WriteLine("");
Console.WriteLine("Enter Complete Address: ");
address = Console.ReadLine();
Console.WriteLine("");
Console.WriteLine("Enter Date of Birth: ");
dob = Console.ReadLine();
Console.WriteLine("");
Console.WriteLine("Enter Age: ");
age = Console.ReadLine();

Console. Console.Display().WriteLine(""). Console. Console.data().WriteLine("").WriteLine("Son/Daughter Of: {0}".WriteLine(""). } } } } . Console.WriteLine(""). Console. email). Console. Console. Console.WriteLine(" Reg. Console. Console.WriteLine("").WriteLine("").WriteLine(""). Regno). Console.WriteLine(" Date of Birth: {0}". Console. Console. Console. Console.WriteLine("Student's Name: {0}". S1.WriteLine(""). Section).WriteLine("").WriteLine("").WriteLine("Enter E-mail Address: ").ReadLine(). Console. age). FName). Class).WriteLine(" Address: {0}". } public void Display() { Console. Console. S1.WriteLine(" Age: {0}". dob). Console.WriteLine(""). Console.WriteLine("").WriteLine(" Section: {0}".WriteLine("").WriteLine(""). email = Console. Console.No#: {0}". Console. Console.WriteLine(" Class: {0}". address). } class Student1 { static void Main(string[] args) { Student S1 = new Student().WriteLine("").WriteLine(" E-mail Id: {0}".WriteLine(""). Console. Console. SName).

namespace ITEM_Calculation { class ITEM { int[] num = new int[5]. .Text. string[] PName = new string[5].Write a simple program in which calculate the total amount of items that are sold.Generic. Program: using System. double[] unitprice = new double[5]. using System.Collections. int[] quantiy = new int[5]. using System. Calculate Total Price after discount. using System.Linq.

quantiy[i]. } Console.WriteLine("Enter unit price").ToDouble(Console.i+1. double TotalPrice = Sum .!!! "). I1. .. double[] Total = new double[5]. } } public void Display() { Console.discount. Console. discount = Convert. double discount. i++) { num[i] = i + 1. Console. num[i]).0) * Sum). double[] TPrice = new double[5].ReadLine()). i++) { Console. int disc = Convert. for (int i = 0. Console. double Sum = 0. public void GetData() { for (int i = 0..ToInt32(Console.TPrice[i]). i < 5. Console.unitprice[i].ReadLine()).WriteLine("\nTotal Amount={0}".ToInt32(Console.PName[i]. Sum). i < 5. Console.WriteLine("\nITEM \t ITEM Name\t Unit Price \t Quantity\t Total Price\n").WriteLine("Total price of this product={0}".TPrice[i]).ReadLine()).WriteLine("\nProduct:{0}".ReadLine().GetData().WriteLine("ENter Discount in %").WriteLine("Enter product name"). Sum = Sum + TPrice[i]. Console. Console. Console.WriteLine("Amount After discount={0}". quantiy[i] = Convert.WriteLine("Please recieve the amount. unitprice[i] = Convert. TotalPrice).WriteLine("ITEM: {0}\t{1}\t\t{2}\t\t{3}\t\t{4}".WriteLine("Enter Quantity"). PName[i] = Console.. } } class Program { static void Main(string[] args) { ITEM I1 = new ITEM(). TPrice[i] = quantiy[i] * unitprice[i].ToDouble((disc / 100.

Display(). I1. } } } Output: .

Generic.Linq. EventArgs e) { if (textBox2. using System.Text. EventArgs e) { } private void Form1_Load(object sender. Generate electric bill.Data. using System. Coding Form 1: using System. namespace Suigas { public partial class Form1 : Form { public Form1() { InitializeComponent(). f2. using System. using System. using System.Drawing. EventArgs e) { } } } . } private void button1_Click(object sender.Forms.Text == "12345") { Form2 f2 = new Form2().ComponentModel. using System.Write a program in Wnindows Form Application. using System.Windows. input User Name and pasword 12345.Show().Collections. login and enter information required to generate bill. } } private void textBox1_TextChanged(object sender. Hide().

Linq. using System. using System.Text. using System. address.ComponentModel. using System. using System.ToDouble(textBox2.Data. EventArgs e) { } private void button1_Click(object sender. EventArgs e) { name = textBox1. punit. using System. public static double cunit.Drawing. prsUnit. namespace Suigas { public partial class Form2 : Form { public static string name. conUnit.Text. address = textBox3. units. mtrno = (Convert.Text. } private void Form2_Load(object sender.Windows. using System.Collections.Forms. type. public Form2() { InitializeComponent(). mtrno. ttlbill.Text)). .Coding Form 2: using System.Generic.

} private void textBox1_TextChanged(object sender.Show(). conUnit = cunit .Text.ComponentModel.punit. . f3. using System. type = textBox6. ttlbill = prsUnit * conUnit.Collections.Text)).punit.ToDouble(textBox5. cunit = (Convert.ToDouble(textBox4.0. punit = (Convert. using System. Hide(). } else { prsUnit = 4.Text)).cunit. conUnit = cunit . EventArgs e) { } } } Coding Form 3: using System. if ((type == "commercial") || (type == "Commercial")) { prsUnit = 8. } Form3 f3 = new Form3().0.Generic. ttlbill = prsUnit * conUnit. conUnit = punit .

conUnit.ToString(). using System.ToString(). label2. m = Form2. EventArgs e) { } private void label12_Click(object sender. t = Form2.Drawing.ToString(). using System.mtrno.name. } private void label1_Click(object sender. } private void Form3_Load(object sender.Windows. EventArgs e) { } } . pc.ttlbill. ad. label5. label6.Forms.Text = pc. amt = Form2.Text = m.Text = amt.Text = nme.Text. public Form3() { InitializeComponent().type. using System.ToString ().Linq.using System.Data.ToString().Text = ad. namespace Suigas { public partial class Form3 : Form { public static double m.address. using System. amt. label3. label4.Text = t. pc = Form2. EventArgs e) { nme = Form2.ToString(). public static string nme. label1. public static string t. ad = Form2.

. Console. string model. namespace CarClass { class Car { string Name. string AutoOrNon.Text.ReadLine().ReadLine().Linq. using System. Name = Console. using System.Collections. model = Console.} Car Class Code Program: using System. string made.WriteLine("Enter Name of Car"). using System. Console.WriteLine("").WriteLine("ENter model #"). public void Data() { Console. string EnginePower. string colour.Generic.

made = Console.WriteLine("Automatic or non-Automatic").WriteLine("made by").WriteLine("").WriteLine("Engine power in Horse or CC: {0}". Console. Console. Console.ReadLine(). made). AutoOrNon = Console.ReadLine(). Console. Console. model). Console. EnginePower = Console.WriteLine(""). colour).WriteLine("Power in cyclic cylender CC ").WriteLine(""). } public void Display() { Console. Console. } } class program1 { static void Main(string[] args) { Car c1 = new Car().WriteLine(" Name: {0}". colour = Console.WriteLine(" Company: {0}".Display().WriteLine(""). c1. Console. c1. Console.ReadLine().WriteLine(" Automatic/Manual?: {0}".Data(). Console. AutoOrNon).ReadLine(). EnginePower).WriteLine(""). Console. Console.WriteLine(" Colour: {0}".WriteLine(" Model # is: {0}".WriteLine("Enter Colour"). Console. Console. Name). } } } Output: .

int storage. using System. public void Data() { Console.WriteLine("").Cell Class Code Program: using System.Linq. namespace CellPhone { class cellphone { string Name.Text.ReadLine().Collections. string IMEI.WriteLine("Enter Name of Cell phone: "). string model. string made.Generic. Name = Console. using System. Console. int extStorage. . using System. string camera.

WriteLine(""). Console.WriteLine("External storage: {0}".WriteLine("internal Storage capacity in Mb: "). extStorage). storage).WriteLine(""). Console. Console. storage = Convert. Console. Console. Console.WriteLine("").WriteLine("Enter IMEI code: ").WriteLine(" Made in: {0}".WriteLine(" IMEI # is: {0}".ReadLine()). Console. Console.WriteLine("").WriteLine(""). } public void Display() { Console.WriteLine(" Name: {0}".WriteLine("").WriteLine("ENter model #: ").WriteLine("Enter external storage Gb: ").ToInt32(Console. made).WriteLine(" Megapixel:{0}". Console.Data(). Console.WriteLine("made in: ").ReadLine()). model = Console.ReadLine().ReadLine(). Name). Console. } } class program1 { static void Main(string[] args) { cellphone c1 = new cellphone().Display(). extStorage = Convert.WriteLine(""). IMEI = Console. Console.ReadLine(). Console. made = Console.WriteLine("").WriteLine(" Internal sorage: {0}". Console.WriteLine(" Model is: {0}". c1. Console. Console. IMEI).WriteLine("").WriteLine(""). Console.WriteLine("").WriteLine("Camera or simple non-camera?: "). Console.ReadLine(). model). Console. } } } . camera). Console. Console. Console. Console.WriteLine(""). c1. camera = Console. Console. Console.WriteLine("").ToInt32(Console.

Linq.Generic. double discount.Collections. using System. double[] price= new double[5].Write a simple program in which calculate the total amount of items that are sold. using System. Calculate Total Price after discount. double[] Total = new double[5]. int[] quantiy = new int[5].Text. double[] unitprice = new double[5]. namespace ItemCalc { class Program { static void Main(string[] args) { int[] ItemNUM = new int[5]. Program: using System. string[] ITEMName = new string[5]. using System. .

Console. for (int i = 0.Total[i]).0) * Sum). ITEMName[i] = Console.ReadLine()).WriteLine("IITEM {0}".discount.WriteLine("Enter ITEM Name").!!! "). ITEMName[i].ItemNUM[i].WriteLine("Enter unit price"). int disc =Convert. Console.ReadLine()).WriteLine("Enter Quantity"). double TotalPrice = Sum . for(int i=0.ToInt32( Console..WriteLine("\nITEM \t ITEM Name\t Unit Price \t Quantity\t Total Price\n"). Total[i] = quantiy[i] * unitprice[i]. quantiy[i] = Convert. Console. unitprice[i] = Convert.i++) { Console.ToDouble(Console..WriteLine("Amount After discount={0}". quantiy[i]. Sum = Sum + Total[i].WriteLine("Please recieve the amount. Total[i]). Console.TotalPrice). double Sum=0.ToInt32(Console.WriteLine("ITEM:{0} \t{1}\t\t{2}\t\t{3}\t\t{4}". } Console.WriteLine(). Console. Console.WriteLine("\nTotal Amount={0}". discount = Convert.WriteLine("ENter Discount in %").ToDouble((disc / 100.Sum). unitprice[i].ReadLine(). i < 5.WriteLine("Total Price of ITEM:{0} ={1}\n".. } Console. Console. i<5. i++) { ItemNUM[i] = i + 1.ItemNUM[i]). } } } Output: . ItemNUM[i]. Console. Console.ReadLine()).

Program: using System.Text.Linq. using System.Write a program to add distance give in meter.Generic. namespace ConsoleApplication1 . using System. kilometer.Collections. using System. and centieter by using operator overloading method.

centimeter = cm.meter. int cm) { kilometer = km.kilometer.{2} centimeter". cm > 99. kilometer. meter. cm = fd. centimeter).kilometer + sd. } public void Display() { Console. } public static Distance operator +(Distance fd. if(m > 999) { for (int n = m. cm-=100 ) { m++.WriteLine("The Total Distance is {0} kilometer.m-=1000 ) { km++. } static void Main(string[] args) { . public Distance(int km. m. cm). Distance sd) { int km. cm. km = fd. m > 999.meter + sd. return d. m = fd. int meter. {1} meter . if (cm > 99) { for (int a = cm. m.centimeter + sd. int m. meter = m.{ class Distance { int kilometer. } } } } Distance d = new Distance(km.centimeter. int centimeter.

WriteLine(ae.Message). Distance d2 = new Distance(25.WriteLine("the size of arguements passed to main method is {0}". 18020).Text. } } public void checksize(int a) { if (a == 0) throw new arrayexception(). } } class program . } catch (arrayexception ae) { Console. 2000. using System.Display().Linq. else { Console. 250). Distance d1 = new Distance(18. 1000. Distance d3 = d1 + d2. namespace exceptionhandling { class arrayexception : Exception { public arrayexception() : base("please enter the command line arguement") { } } class throwarrayexception { public throwarrayexception(int a) { try { checksize(a). using System.Generic. d3. a). CODING: using System.Collections. using System. } } } Output: Make an exception in a program & handle it.

Forms. { static void Main(string[] args) { new throwarrayexception(args.Navigate(txt_Url. } private void txt_Url_KeyPress(object sender.Url.Text = webBrowser1.KeyChar == (char)13) { webBrowser1. btn_fwd.ToString(). btn_backwrd.Enabled = false. } private void webBrowser1_Navigated(object sender. } } private void Form1_Load(object sender. using System.Length). EventArgs e){ btn_Stop. .Collections.Text. this. using System.Enabled = false.ToString(). } } } } OUTPUT: Design a web browser in C# using System.Windows. using System.Data. using System.DocumentTitle.Generic.Text = webBrowser1.Text).ComponentModel. using System.Enabled = false.Drawing. WebBrowserNavigatedEventArgs e){ txt_Url.Linq. using System. using System. namespace BrowserExample { public partial class Form1 : Form { public Form1({ InitializeComponent(). KeyPressEventArgs e){ if (e.

ToString().} else{ btn_fwd.GoBack(). EventArgs e){ webBrowser1.Enabled = false.} else{ btn_fwd. EventArgs e){ webBrowser1.Text). } private void btn_Favourite_Click(object sender.GoHome().Url. webBrowser1.} if (webBrowser1.Text = webBrowser1.Stop(). } private void webBrowser1_Navigating(object sender.Navigate(txt_Url. } private void btn_backwrd_Click_1(object sender. } private void btn_Stop_Click_1(object sender.Enabled = false.Enabled = false. } private void btn_GO_Click_1(object sender.Url. } private void btn_fwd_Click_1(object sender. EventArgs e){ } } } . EventArgs e){ webBrowser1. EventArgs e){ webBrowser1. EventArgs e){ webBrowser1.ToString().Enabled = true. txt_Url.WebBrowserDocume ntCompletedEventArgs e){ btn_Stop.Text = webBrowser1.Url. } } private void btn_Home_Click_1(object sender. WebBrowserNavigatingEventArgs e) { btn_Stop. EventArgs e){ webBrowser1.CanGoBack){ btn_fwd.Enabled = true.Enabled = true. txt_Url. } private void btn_Refresh_Click_1(object sender.GoForward().CanGoBack){ btn_fwd. } private void webBrowser1_DocumentCompleted(object sender.Refresh(). if (webBrowser1.ToString().Text = webBrowser1.

Take 10 inputs from the user and assign them into two arrays (make 2 arrays of 5 lengths
each), merge those arrays and obtain the result in the sorted manner.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Merg
{
class Program
{
static void Main(string[] args)
{

int[] Ary1 = new int[5];
Console.WriteLine("Enter the 5 values of First Array array");
for (int i = 0; i < 5; i++)
{
Ary1[i] = int.Parse(Console.ReadLine());
}
int[] Ary2 = new int[5];
Console.WriteLine("Enter the 5 values of Second array");
for (int i = 0; i < 5; i++)
{
Ary2[i] = int.Parse(Console.ReadLine());
}
int[] Ary = new int[Ary1.Length + Ary2.Length];
Ary1.CopyTo(Ary, 0);

Ary2.CopyTo(Ary, Ary1.Length);
for (int i = 0; i < 9; i++)
{
int min = i;
for (int j = i + 1; j < 10; j++)
{
if (Ary[j] < Ary[min])
{
min = j;
}
}
}
Console.WriteLine("Sorting values by using merg sort");
for (int i = 0; i < 10; i++)
{
Console.Write("{0}",Ary[i]);
Console.Write(" ");
}
}
}
}

Output:

Create a class ElectricityBilling that contains a function which calculates total billing amount with the
help of inputs and displays the yearly bill as well. Take name, consumer_id, consumer_type as input,
where as pressure and consumed units are available by default as static members. Calculate the
monthly bill based on the type of consumer. Also display the yearly bill.

Code

using System;
using System.Collections.Generic;
using System.Linq;

using System.Text;

namespace Atif
{

class ElectricityBilling
{
static string name, consumerId, consumerType;
static double pressure = 5.5;
static double consumerUnit=2.3;
public static void totalBill()
{

Console.Write("Enter Your Name :: ");
name= Console.ReadLine();
Console.Write("Enter Consumer Id :: ");
consumerId = Console.ReadLine();
Console.Write("Enter consumer Type :: ");
consumerType = Console.ReadLine();

double Month =( pressure * consumerUnit) * 1;
Console.WriteLine("Your Monthly Bill is :: "+Month);
double Yearly = (pressure * consumerUnit) * 12;
Console.WriteLine("Your Yearly Bill is :: "+Yearly);

}

}

class Program
{
static void Main(string[] args)
{
ElectricityBilling.totalBill();

}
}
}

Screen Shor

Text == "" && maskedTextBox1.Windows.Forms. using System. EventArgs e) { if (textBox1.Show("Enter Data in all fields"). } private void button1_Click(object sender.ComponentModel.Text. using System. .How to make Simple Phone Book Code using System.Text. using System. using System.Tasks. textBox2.Text. maskedTextBox1.Linq.Text = "". namespace PhoneBook { public partial class Form1 : Form { public Form1() { InitializeComponent().Text == "" && textBox2.Collections.Threading.Add(textBox1. using System.Length < 11) MessageBox.Rows.Text).Generic. using System.Drawing. else { dataGridView1.Data. using System.Text = "". textBox1. using System. textBox2.Text.

Cells[2].Value = textBox4. else { dataGridView1. } } private void Form1_Load(object sender.Cells[2].Value.Text = dataGridView1.Text. textBox4.SelectedRows[0].RemoveAt(dataGridView1.Text = "". } } private void button2_Click(object sender.Text.Show("Enter Data in all fields").Rows.Focus().Cells[0].ToString().Cells[1].SelectedRows[0].SelectedRows[0]. maskedTextBox2.Length < 11) MessageBox.Text == "" && textBox4.Value = maskedTextBox2.Text = dataGridView1.Index). textBox1. maskedTextBox1.Text == "" && maskedTextBox2. MessageBoxButtons. "Confirmation".YesNo). } } private void dataGridView1_CellClick(object sender. dataGridView1.Value. } private void dataGridView1_CellDoubleClick(object sender.Yes) { dataGridView1.SelectedRows[0]. DataGridViewCellEventArgs e) { DialogResult Result = MessageBox.SelectedRows[0].Value.Cells[1]. DataGridViewCellEventArgs e) { textBox3.SelectedRows[0]. if (Result == DialogResult.Show("Do you really want to Delete???".Text. EventArgs e) { } } } Screen Shot .Text.ToString().Cells[0].SelectedRows[0].Value = textBox3.Text = dataGridView1. EventArgs e) { if (textBox3.ToString(). dataGridView1.

.blogspot.html#sthash.See more at: http://softproweb.dpuf How to make a simple Age calculator in c# .in/2013/06/how-to-make-simple-phone- book.SniZpsfq.

.

ComponentModel. . using System.Collections.Generic.Code using System. using System.

Forms.ToString(). using System.Text.using System.Threading. DateTime. out dateOfBirth). using System.Text.1. DateTime age = DateTime.1.Month .Windows. using System.Day . TimeSpan difference = currentDate.Linq.ToString(). textBox3. int ageInMonths = age. EventArgs e) { . textBox2. DateTime currentDate = DateTime. int ageInYears = age.1.Text = (ageInDays).Text = (ageInMonths). } private void button1_MouseHover(object sender. namespace Age_Calculator { public partial class Form1 : Form { public Form1() { InitializeComponent(). EventArgs e) { DateTime dateOfBirth. using System.Now.Data.MinValue + difference. int ageInDays = age. textBox1.Tasks.ToString().Drawing.Year . using System.TryParse(maskedTextBox1.Subtract(dateOfBirth).Text = (ageInYears). } private void button1_Click(object sender.

} private void maskedTextBox1_MouseHover(object sender. EventArgs e) { } } } . "Exit").No) { e. } } private void Form1_Load(object sender. } private void Form1_FormClosing(object sender. "Enter to Calculate Your Age").SetToolTip(this.button2.maskedTextBox1. "Confirmation". EventArgs e) { toolTip1.SetToolTip(this. result = MessageBox.button1.Exit().Cancel = true. } private void button2_Click(object sender. EventArgs e) { Application. if (result == DialogResult.Show("Do you realy want to close". EventArgs e) { toolTip1. MessageBoxButtons.YesNo). FormClosingEventArgs e) { DialogResult result. } private void button2_MouseHover(object sender. "Enter your Birth Date"). toolTip1.SetToolTip(this.

See more at: http://softproweb. border-collapse:collapse.demo { position:absolute. } . border-color: blue. font-family:Arial. top:380px. font-weight:bold. } #tbl. } </STYLE> <SCRIPT> function myFun() { . font-size:17. position: absolute.in/2013/04/how-to-make-simple-age-calculator-in- c. margin-top:35px. top:355px.blogspot. background-color: #CCC. font-family:Century Gothic. } #demoname { font-size:15px } .btn { position:absolute. padding: 30px 30px 50px 30px.5JLZ0j5r.html#sthash. font-size:18. height: 705px.dpuf Real marksheet using HTML Code: <HTML> <HEAD> <STYLE> body { border-radius: 20px. left:35px. border-style: double. left:720px. top: 15px.#tbl2 { border-collapse:collapse. width: 850px.. left: 45px.

var a=document. case(txt2>=60): document.txtit.innerHTML=f.toFixed(2)+"%".form1. break.getElementById("demototal").form1. var f=document.getElementById("democ").value.innerHTML=a.form1. document.txtweb.txtins.innerHTML="C". document.value)+parseFloat(document. document.innerHTML=h. var h=document.form1. var d=document.value.form1. var txt2=eval(parseFloat(txt1*100)/400).getElementById("demoper").innerHTML=txt2.><U>STUDENT MARKSHEET</H1> <FIELDSET> <LEGEND> STUDENT INFORMATION </LEGEND> <TABLE align="center" id="tbl"> <FORM name="form1"> </TR> <TD width="140">Name:</TD> <TD><INPUT type="text" name="txtname"/></TD> <TD> &nbsp. var b=document. case(txt2>=40): document. break.form1. charset=utf-8"> </HEAD> <BODY> <DIV class="color"> <H1 align="center"style="font-family:cambria. document. document.value.txtoffice.form1.getElementById("demoins").innerHTML="Fail".innerHTML="A1".getElementById("demograde").txtc. case(txt2>=70): document.Father Name:</TD><TD> <INPUT type="text" name="txtfname"/></TD> </TR> .getElementById("demograde"). break.value.innerHTML=c.txtoffice. var txt1=eval(parseFloat(document.txtc. &nbsp.txtname.getElementById("demooffice").font-size:40".value. document.form1.form1.value) +parseFloat(document.getElementById("demograde").getElementById("demograde"). } } </SCRIPT> <meta http-equiv="Content-Type" content="text/html.value)). var g=document.value.innerHTML=b.value. case(txt2<40): document. document.getElementById("demofname"). break. case(txt2>=50): document.txtbatch.txtweb.getElementById("demoname").getElementById("demograde"). break. break.innerHTML=d.innerHTML=g.form1. document.getElementById("demograde"). document.innerHTML="B".txtfname.value)+parseFloat(document.innerHTML="D".innerHTML=e.txtit. document.form1. var c=document. switch(true) { case(txt2>=80): document.getElementById("demoit").getElementById("demobatch").value.innerHTML=txt1.form1.innerHTML="A". var e=document.getElementById("demoweb").

</TD> </TR> </TABLE> </FIELDSET> <DIV class="btn"> <button style="font-size:17" type="button" onclick='myFun()'>Submit</button> <button style="font-size:17" type="Reset">Reset</button> </DIV> <DIV class="demo"> <TABLE border="1"> <TR> <TH colspan="8" width="240"> Student Information </TH> </TR> <TR> <TD width="135">Name:</TD><TD><FONT face="arial" id="demoname"></FONT></TD> </TR> <TR> <TD width="135">Father Name:</TD><TD><FONT face="arial" id="demofname"></FONT></TD> </TR> <TR> <TD width="135">Institute Name:</TD><TD><FONT face="arial" id="demoins"></FONT></TD> </TR> <TD width="135">Batch:</TD> <TD><FONT face="arial" id="demobatch"></FONT></TD> </TR> <TR> <TH colspan="8" width="240"> Subjects Marks </TH> </TR> <TR> <TD width="135">Office Automation:</TD> <TD><FONT face="arial" id="demooffice"></FONT></TD> </TR> <TR> <TD width="135">Web Designing:</TD><TD><FONT face="arial" id="demoweb"></FONT></TD> .<TR> <TD width="140" > Institute Name:</TD><TD> <INPUT type="text" name="txtins"/></TD> <TD style="text-indent:16px">Batch:</TD><TD> <INPUT type="text" name="txtbatch"/></TD> </TR> </TABLE> </FIELDSET></BR> <FIELDSET> <LEGEND> SUBJECTS MARKS </LEGEND> <TABLE id="tbl2"> <TR> <TD> Office Automation:</TD><TD> <INPUT type="text" name="txtoffice" maxlength="2" size="10"/> Out of 100 </TD> </TR> <TR> <TD> Web Designing:</TD><TD> <INPUT type="text" name="txtweb" maxlength="2" size="10"/> Out of 100</TD> </TR> <TR> <TD> IT:</TD><TD> <INPUT type="text" name="txtit" maxlength="2" size="10"/> Out of 100</TD> </TR> <TR> <TD> C# Programing:</TD><TD> <INPUT type="text" name="txtc" maxlength="2" size="10" /> Out of 100</TD> </TR> <TR> <TD>&nbsp.

in/2013/12/real-marksheet-using- html.dpuf .See more at: http://softproweb.</TR> <TD width="135">IT:</TD><TD><FONT face="arial" id="demoit"></FONT></TD> </TR> <TR> <TD width="135">C# Programing:</TD><TD><FONT face="arial" id="democ"></FONT></TD> </TR> <TR> <TH colspan="8" width="240"> Marks Result </TH> </TR> <TR> <TD width="135">TOTAL:</TD><TD> <FONT face="arial" id="demototal"></FONT></TT></TD> </TR> <TR> <TD width="135">Percentage:</TD><TD><FONT face="arial" id="demoper"></FONT></TD> </TR> <TR> <TD width="135">Grade:</TD><TD><FONT face="arial" id="demograde"></FONT></TD> </TR> </TABLE> </DIV> </DIV> </BODY> </HTML> Screen Shot: .blogspot.html#sthash.eV8CSXk0.

Lastname = Console. using System.ReadLine(). string Father Name. string Gender.. string Email) { Console..ReadLine(). .. namespace wasiq_khan { class DisplayData { string Programe.. string Address..Text. } public DisplayData(string FirstName. ")..ReadLine().Generic. using System. ").Collections.Write("My Father Name is.Write("My Gender is.. FirstName = Console.. "). Create a class Student for student registration system using constructors.. string Lastname. Campus = "Bahria University Karachi Campus". FatherName = Console.. ").ReadLine().Write("My First Name is.Write("My Last Name is. The class must include:  First name  Last name  Father’s name  Program  University = Bahria University  Address  Gender  Email  Campus  Semester Initialize the following in the default constructor:  Program  Campus  Semester Also write methods for getData() and displayData(). Code sing System.. Gender = Console. public DisplayData() { Programe = "Computer Science". Console. semister. Console. semister = "4Th Semister". Console.. Campus.

"+semister)."+Programe). Console. Console.... string Addr="".. "). DisplayData obj = new DisplayData( FiName.. Email = Console. Ema).Laname.. } public void GetData() { Console. } } } screen shot ..... Address = Console..Write("My Address is. Console....WriteLine("My Campus is.. FName. Gend. string Ema="". string Laname="". ob.GetData(). } } class Program { static void Main(string[] args) { string FiName=""... "+Campus). string Gend="". Console.. string FName=""..Write("My Email.").ReadLine().ReadLine(). Addr.WriteLine("My Program is... DisplayData ob = new DisplayData().WriteLine("My Semister is.

Other Benefit 2 (20000. Year End Bonus. Deductions: TextBox Provident Fund Deduction.in/2013/05/how-to-make-student-information- program. Calculate the Salary based on the user input regarding above features and display the result 9. Employee Grade Level: (ComboBox) Director. . Customer appreciation Bonus (20000.000.Collections. Project Manager. 100.lB2cDQ6A. 10000 respectively) 6.000.000 Basic Salary value should be read only and automatically selected based on the selected Employee Grade Level 5. Performance Bonus.See more at: http://softproweb. An Exit button. Basic Salary: (RadioButton) 30. 25000.dpuf Develop an application with one screen that calculates the monthly salary of an employee. RadioButton. 30000. 50.000. Make sure you use all of the following components: Label.Generic. ComboBox. Manager. 15000) 7. Programmer 4. 15000. using System. 10000. CheckBox.ComponentModel. GroupBox 2. Conveyance Allowance. Medical Deduction 8. Button. TextBox. Code using System. ListBox. Benefits: (CheckBox) Housing Allowance. Your application should satisfy the following requirements: 1. Other Benefit 1. 40. . Bonuses: (ListBox) Project Completion Bonus. Employee Name: (TextBox) 3.html#sthash.blogspot. using System.

using ClassLibrary1. using System. if (c5.Count).Text. } private void Ext_Click(object sender.Checked == true) sal -= 2500.Checked == true) sal -= 1500.Enabled = false. using System.Forms.Checked == true) sal += 5000. tb2. } private void cal_Click(object sender. if (c4. using System. sal += (10000 * lb1.Close().Text). namespace lab3 { public partial class Form1 : Form { public Form1() { InitializeComponent(). } private void cb2_SelectedIndexChanged(object sender. if (c6.Checked == true) sal += 5000.ToString().Text = sal. sal += int. cal. EventArgs e) { int sal = 0. E ventArgs e) { .Windows. if (c2. using System.Data.Linq. if (c1.Parse(cb2.Drawing.using System. if (c3.Checked == true) sal += 5000.Checked == true) sal += 5000.SelectedIndices. EventArgs e) { this.

Text != "" && cb1.Count > 0) cal.Enabled = true. } private void tb1_TextChanged(object sender.Checked == true || r2.SelectedIndex >= 0 && (r1.Count > 0) cal.SelectedIndices.Text != "" && cb1. EventArg s e) .SelectedIndex = 2. if (cb1. } private void r1_CheckedChanged(object sender.SelectedIndex >= 0 && (r1.Checked == true || r2. E ventArgs e) { if (tb1. if (cb1.SelectedIndex == 2) cb2.SelectedIndex = 3.SelectedIndices.SelectedIndex == 3) cb2.Checked == true) && cb2.Enabled = true. EventArgs e) { } private void lb1_SelectedIndexChanged(object sender.Count > 0) cal.Checked == true) && cb2. } private void cb1_SelectedIndexChanged(object sender.Checked == true) && cb2.Checked == true || r2.SelectedIndex >= 0 && lb1. if (tb1.SelectedIndices.Enabled = true.SelectedIndex = 1.Enabled = true. if (cb1.SelectedIndex >= 0 && (r1.Text != "" && cb1. if (tb1.SelectedIndex >= 0 && lb1.SelectedIndex >= 0 && lb1. } private void gb1_Enter(object sender. EventArgs e) { if (tb1.Checked == true || r2.Text != "" && cb1.Count > 0) cal.SelectedIndex == 0) cb2.SelectedIndex == 1) cb2.Checked == true) && cb2.SelectedIndex >= 0 && (r1. E ventArgs e) { if (cb1.SelectedIndex >= 0 && lb1.SelectedIndices.SelectedIndex = 4.

Checked == true) && cb2. tb1. EventArg s e) { if (tb1.Text = x. } private void button1_Click(object sender.Count > 0) cal.fn(3).Enabled = true.Text != "" && cb1.SelectedIndices. int x = asd.Checked == true) && cb2.Text != "" && cb1.SelectedIndex >= 0 && lb1.SelectedIndex >= 0 && lb1. } private void r2_CheckedChanged(object sender.Checked == true || r2. { if (tb1.Count > 0) cal.SelectedIndices. } } } Screen Shot .Checked == true || r2.SelectedIndex >= 0 && (r1.Enabled = true.ToString(). EventArgs e) { Class1 asd = new Class1().SelectedIndex >= 0 && (r1.

QW03ihhv.html#sthash..com/- kYxgHwfb6V4/UawlWdsss_I/AAAAAAAAApo/M_TMAnnkYao/ 166571_367932973267402_1468747437_n.in/2013/05/develop-application-with-one- screen.dpuf Resume in Html Code <html > <head> <title>Resume Of Waqeeh Ul Hasan</title> </head> <body> <h3> Resume Of <h1>Waqeeh Ul Hasan</h3> <p> <img border="0" src="http://lh6.blogspot.jpg" alt="Pulpit rock" width="74" height="78"> <br>123 Gulshan-e-Iqbal Block 10/A<br> Karachi.See more at: http://softproweb.ggpht. Pakistan and 75360 .

</p><p> 111 999 111<br> Resum@gmail.com </p> <hr> <h2>Skills</h2><ol> <li> Web Design </li> <li> Interface Desig </li> <li> Project Direction</li> </ol><hr><h2>Technical </h2> <ol> <li> XHML </li> <li> CSS </li> <li> Javascript </li> <li> Jquery </li> <li> PHP</li> <li> Windows Server 2008 </li> </ol><hr> <h2> Educational Background </h2> <h3>Primary Education </h3> <p> Bahria college NORE 1 </p> <h3> Secondary Education </h3> <p> Bahria college NORE 1 </p> <h3> Higher education </h3> <p> Bahria university karachi campus </p> <hr><h2> Job Experience </h2> <p> 1 year experience in a Food Court</p> <p> 2 year experience in a Vogure office </p><hr> </body> </html> Screen Shot .

Code <html > <head> <title>Resume Of Waqeeh Ul Hasan</title> </head> <body> <h3> <center> Resume Of <h1>Waqeeh Ul Hasan <center> </h3> <h2>Personal Information </h2> <table border="3"> . LAB 02: Lab Tasks: 4. Attach printout of modified page. Change the value of width in <HR> tag from 50% to 80%.

<tr> <td> 123 Gulshan-e-Iqbal Block 10 Karachi.com </td> </tr> </table> </p> <hr> <h2>Skills</h2> <table border="3"> <tr> <td> Web Design </td> </tr> <tr> <td>Interface Design </td> </tr> <tr><td> Project Direction </td> </tr> </table> </body> </html> Screen Shot: . Pakistan and 75360 </td> <tr> <td> 111 999 111 </td> </tr> <td> Resum@gmail.

<A>.4. <B>. Pakistan and 75360 </td> <tr> <td> <b> 111 999 111 </b> </td></tr> <td> <a href="Resum@gmail.com">Resum@gmail.com</a> </td> </tr> </table> </p> <hr> <h2>Skills </h2> <table border="3"> <tr> . Code: <html > <head> <title>Resume Of Waqeeh Ul Hasan</title> </head> <body> <h3> <center> Resume Of <h1>Waqeeh Ul Hasan <center> </h3> <hr> <h2>Personal Information </h2> <table border="3"> <tr> <td> 123 Gulshan-e-Iqbal Block 10 Karachi. <BR> and <HR> tags. Write a code for HTML page with the <ELEMENT>. <H>. <P>.

qum866yb. background-color: #966.<td> Web Design </td> </tr><tr> <td>Interface Design </td> </tr><tr> <td> Project Direction </td> </tr> </table> <hr> </body> </html> Screen Shot: . margin-right: 190px.blogspot.See more at: http://softproweb.See more at: http://softproweb.html#sthash.bgCRBOi9.dpuf Create Signup page with Validation using JavaScript . margin-top: 5px. .in/2013/12/create-signup-page-with-validation.in/2013/11/resume-in-html.blogspot.html#sthash.dpuf Code: <html> <head> <title>Signup || Nested-code team</title> <style type="text/css"> <!-- body { margin-left: 150px.

} if(document.} --> </style> <script language="javascript"> function check() { if(document.focus().value=="") { alert("Plese Enter Contact No"). .city. document.value) { alert("Confirm Password does not matched").pass.focus().form1.form1.form1. document.form1.phone.focus().value=="") { alert("Plese Enter Login Id"). document.form1.value=="") { alert("Plese Enter your Email Address"). document.focus().value=="") { alert("Plese Enter Your Name").name.lid.form1.form1. } if(document. return false.value=="") { alert("Plese Enter Confirm Password"). } if(document. return false.form1. document. document.form1.form1. } if(document. return false. return false.focus().form1. return false. } if(document.pass. return false.email.focus().form1. return false.form1.value=="") { alert("Plese Enter City Name"). document.lid.form1.name. } if(document.form1. document.address.form1.focus().cpass.value=="") { alert("Plese Enter Your Password"). document.pass.form1.focus().email. } if(document.cpass.focus().value=="") { alert("Plese Enter Address").form1.city.phone.address.cpass.cpass. } if(document.value!=document.form1. return false.

form1.th { color: #C30.focus()."> <table width="532" height="341" border="0" align="left" bordercolor="#CCFF99" bordercolordark="#00CCFF" cellpadding="2" cellspacing="3" > <tr> <td><div align="left" class="style7">Login Id </div></td> <td><input type="text" name="lid"></td> .form1. } return true.e1+1). } .td. } .email.dff { color: #00F. } . } </style> <meta http-equiv="Content-Type" content="text/html.indexOf('@'. if(!(f1>0 && f2==-1 && e1>0 && e2==-1 && f1!=e1+1 && e1!=f1+1 && f1!=n-1 && e1!=n-1)) { alert("Please Enter valid Email"). document.'.css" rel="stylesheet" type="text/css"> <style type="text/css"> body. n=e.style7 { color: #0F0. e2=e.length. } a:link { color: #06F.f1+1). f1=e.value. charset=utf-8"> </head> <body><center></center> <br> <table width="100%" height="534" border="0"> <tr> <td width="206" rowspan="2" valign="top">&nbsp. return false. } a:visited { color: #06F. e1=e.y { color: #FF0. } e=document.').indexOf('.</td> <td width="651" height="57"><h1 align="left"><span class="d">New</span> <span class="dff">User</span><span class="style8"> <span class="y">Signup</span></span></h1></td> </tr> <tr> <td><form name="form1" method="post" action=" " onSubmit="return check().indexOf('. } . } </script> <link href="quiz.d { color: #0F0. return false.indexOf('@').email. f2=e.

</tr> <tr> <td class="style7">Password</td> <td><input type="password" name="pass"></td> </tr> <tr> <td class="style7">Confirm Password </td> <td><input name="cpass" type="password" id="cpass"></td> </tr> <tr> <td class="style7">Name</td> <td><input name="name" type="text" id="name"></td> </tr> <tr> <td valign="top" class="style7">Address</td> <td><textarea name="address" id="address"></textarea></td> </tr> <tr> <td valign="top" class="style7">City</td> <td><input name="city" type="text" id="city"></td> </tr> <tr> <td valign="top" class="style7">Phone</td> <td><input name="phone" type="text" id="phone"></td> </tr> <tr> <td valign="top" class="style7">E-mail</td> <td><input name="email" type="text" id="email"></td> </tr> <tr> <td>&nbsp.</td> <td><input type="submit" name="Submit" value="Signup"> </td> </tr> </table> </form></td> </tr> </table> <br><br><br><br><br> <center></center> </body> </html> Screen Shot: .

See more at: http://softproweb.html#sthash.org/TR/xhtml1/DTD/xhtml1-transitional.heading ..bgCRBOi9. charset=iso-8859-1" /> <title>CoOl Javascript Validation</title> <script type="text/javascript" src="cvalidate.w3.in/2013/12/create-signup-page-with- validation.js"></script> <style type="text/css"> .blogspot.dpuf HTML Validation with Javascript Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.dtd"> <html xmlns="http://www.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html.0 Transitional//EN" "http://www.w3.

Arial.txt { font-family:Verdana. font-size:20px.true)"> <table width="350" border="0" cellspacing="0" cellpadding="5" align="center" bgcolor="#F4FAFF" style="border:1px solid #0099FF. sans-serif. } . font-size:12px.blogspot."><a href="http://softproweb.{ color:#0099FF."> <tr> <td colspan="2" class="heading" align="center" style="border-bottom:1px solid #0099FF. } </style> </head> <body> <form name="frmValidate" id="myform" action="" method="post" onsubmit="return validateForm('myform'. Helvetica. font-weight:bolder.com/">Submit Form</a></td> </tr> <tr> <td colspan="2" class="heading" align="center" height="10"></td> </tr> <tr> <td align="left" class="txt">Username *</td> <td align="right"><input type="text" name="username" id="username" size="28" title="Username" class="required alpha" /></td> </tr> <tr> <td align="left" class="txt">Password *</td> <td align="right"><input type="password" name="password" id="password" size="28" title="Password" class="required alpha min 6 max 20 match cpassword" /></td> </tr> <tr> <td align="left" class="txt">Confirm Password *</td> <td align="right"><input type="password" name="cpassword" id="cpassword" size="28" title="Confirm Password" class="required alpha" /></td> </tr> <tr> <td align="left" class="txt">First Name *</td> <td align="right"><input type="text" name="fname" id="fname" size="28" title="First Name" class="required text" /></td> </tr> <tr> <td align="left" class="txt">Last Name</td> <td align="right"><input type="text" name="lname" id="lname" size="28" title="Last Name" /></td> </tr> <tr> <td align="left" class="txt">Age *</td> <td align="right"><input type="text" name="age" id="age" size="28" title="Age" class="required number min 10 max 100 " /></td> </tr> <tr> <td align="left" class="txt">Email *</td> .

<td align="right"><input type="text" name="email" id="email" size="28" title="Email" class="required email" /></td> </tr> <tr> <td align="left" class="txt">Phone *</td> <td align="right"><input type="text" name="phone" id="phone" size="28" title="Phone" class="required regex ^\-?\d+$" /></td> </tr> <tr> <td align="left" class="txt">Fax</td> <td align="right"><input type="text" name="fax" id="fax" size="28" title="Fax" /></td> </tr> <tr> <td align="left" class="txt">Date Of Birth *</td> <td align="right"><input type="text" name="dob" id="dob" size="28" title="Date Of Birth" class="required date" /></td> </tr> <tr> <td align="left" class="txt">Website *</td> <td align="right"><input type="text" name="website" id="website" size="28" title="Website" class="required web" /></td> </tr> <tr> <td align="left" class="txt">Country *</td> <td align="left">&nbsp.Select ---</option> <option value="Canada">Canada</option> <option value="UK">UK</option> <option value="USA">USA</option> <option value="Pakistan">Pakistan</option> <option value="Other">Other</option> </select> </td> </tr> <tr> <td align="left" class="txt">Gender *</td> <td align="left"> <input type="radio" name="gender" value="m" title="Gender" class="required" />Male <input type="radio" name="gender" value="f" title="Gender" class="required" />Female </td> </tr> <tr> <td align="left" class="txt">Disclaimer *</td> <td align="left"> <input type="checkbox" name="disclaimer" value="1" title="Disclaimer" class="required" /> </td> </tr> <tr> <td align="right" colspan="2"> <input type="submit" name="btnSubmit" value="Submit Form" /> </td> </tr> </table> </form> <br /><br /> Screen Shot: . <select name="country" id="country" title="Country" class="required"> <option value="">--.

.

See more at: http://softproweb. border-color: blue.html#sthash.o{ color: #F30.blogspot.} </style> </head> <body> <table border="0" align="center" cellspacing="4" cellpadding="2" witdh="100%" height="40%"> <th class="o">ID</th> <th class="o">NAME</th> .in/2013/12/html-validation-with- javascript..dpuf How to make fancy table in html Code: <head> <title> lab 7 task 1 </title> <style> . } #a{background-color:grey.aLi3sUTE.

LOCATION</th> <th class="o">PRICE</th> <tr id="a"> <td>203A</td> <td>Hasan<A HREF="http://softproweb.bio)</A></td> <td>Singer</td> <td>Newyork</td> <td>$39.com/">(pic)</A></td> <td>Producer</td> <td>Newyork</td> <td>$19.com/">(bio)</A></td> <td>Front-man</td> <td>Los Angeles</td> <td>$39.95</td> </tr> <tr id="a"> <td>8A05</td> <td>Faisal<A HREF="http://softproweb.blogspot.blogspot.com/">(pic.blogspot.95</td> </tr> <tr id="a"> <td>2031</td> <td>Zain<A HREF="http://softproweb.blogspot.com/">(bio.95</td> </tr> </table> </body> .com/">(pic)</A></td> <td>DJ</td> <td>London</td> <td>$19.blogspot.blogspot.<th class="o">OCCUPATION</th> <th class="o">APPROX.95</td> </tr> <tr> <td>007F</td> <td>Kashif<A HREF="http://softproweb.95</td> </tr> <tr> <td>6636</td> <td>talha<A HREF="http://softproweb.press)</A></td> <td>Singer</td> <td>Omaha</td> <td>$11.95</td> </tr> <tr> <td>141B</td> <td>Amir<A HREF="http://softproweb.press)</A></td> <td>Keytarist</td> <td>London</td> <td>$39.com/">(bio.

jUlYPYYx.See more at: http://softproweb.in/2013/12/how-to-make-fancy-table-in- html. public override string Name { get { return(name).blogspot. } .dpuf using System. public abstract class Employee { public abstract string Name { get.html#sthash. } } class Engineer: Employee { string name = "Engineer".Screen Shot: .

WriteLine("InterfaceB implementation of MethodA()"). } } Name: Engineer using System. } public interface InterfaceB : InterfaceA { new void MethodA().Name). } } class MainClass { public static void Main() { Employee d = new Engineer(). d. // hides MethodA() in InterfaceA } public class MyClass : InterfaceB { void InterfaceB.WriteLine("Name: {0}". public interface InterfaceA { void MethodA(). Console.MethodA() { Console. .

Console.MethodA()"). Console. myDrivable. Console.MethodA() InterfaceB implementation of MethodA() Calling myDrivable.MethodA().MethodA()"). myClass.WriteLine("Calling myClass.WriteLine("InterfaceA implementation of MethodA()").MethodA()"). } } Calling myClass.WriteLine("Calling myDrivable. mySteerable.MethodA().MethodA() InterfaceA implementation of MethodA() . } } class MainClass { public static void Main() { MyClass myClass = new MyClass().MethodA(). InterfaceA myDrivable = myClass as InterfaceA.WriteLine("Calling mySteerable. InterfaceB mySteerable = myClass as InterfaceB. } public void MethodA() { Console.MethodA() InterfaceA implementation of MethodA() Calling mySteerable.

InterfaceTwo { void InterfaceOne. interface InterfaceOne { void Execute(). } } class MainClass { public static void Main() { MyImplementation MyImplementation = new MyImplementation(). } class MyImplementation: InterfaceOne.Execute().Execute implementation").Execute() { Console. } void InterfaceTwo. InterfaceOne. . InterfaceOne InterfaceOne = (InterfaceOne) MyImplementation.WriteLine("InterfaceOne.WriteLine("InterfaceTwo.Execute() { Console.Execute implementation"). } interface InterfaceTwo { void Execute().using System.

Execute implementation InterfaceTwo.Execute implementation using System.WriteLine("InterfaceTwo. } class MyImplementation: InterfaceOne. InterfaceTwo. InterfaceTwo { void InterfaceOne. } } InterfaceOne. interface InterfaceOne { void Execute().Execute().WriteLine("InterfaceOne. } public void Execute() { ((InterfaceOne) this).Execute implementation").Execute() { Console.Execute() { Console. } interface InterfaceTwo { void Execute(). .Execute(). InterfaceTwo InterfaceTwo = (InterfaceTwo) MyImplementation.Execute implementation"). } void InterfaceTwo.

MyClass. } } class MainClass { public static void Main() { MyImplementation MyImplementation = new MyImplementation().Execute().StaticProperty). public static int StaticProperty { set { myValue = value. } } InterfaceOne.WriteLine("Init Value: {0}". class MyClass { static int myValue. } } } class MainClass { static void Main() { Console. . MyImplementation.Execute implementation using System. } get { return myValue.

class MyClass { class MyCounter { public int Count = 0. } } class MainClass { static void Main() .Count. } public int Incr() { return counter. public MyClass() { counter = new MyCounter().StaticProperty).Count++.WriteLine("New Value : {0}". MyClass. Console. } private MyCounter counter.StaticProperty = 10. MyClass. } } Init Value: 0 New Value : 10 using System. } public int GetValue() { return counter.

Incr().Incr(). mc. } . MyDelegate Multicast = null. { MyClass mc = new MyClass(). Multicast += new MyDelegate(DoSomething). mc. Multicast(MyString). mc. mc.Incr(). class MainClass { delegate int MyDelegate(string s).Incr().WriteLine("Total: {0}". mc. mc. Console.GetValue()). Multicast += new MyDelegate(DoSomething2). mc. } } Total: 6 using System. static void Main(string[] args) { string MyString = "Hello World".Incr().Incr().

static int DoSomething(string s) { Console. class MainClass { delegate int MyDelegate(string s). } } DoSomething DoSomething2 using System. return 0. } static int DoSomething2(string s) { Console. return 0.WriteLine("DoSomething2"). . //Or you can Multicast delegates by doing this MyDelegate Multicast = null. Multicast -= new MyDelegate(DoSomething2). Multicast += new MyDelegate(DoSomething2). Multicast += new MyDelegate(DoSomething). static void Main(string[] args) { string MyString = "Hello World".WriteLine("DoSomething").

WriteLine("DoSomething").WriteLine("nonStaticMethod"). } static int DoSomething2(string s) { Console.WriteLine("DoSomething2"). } public static void staticMethod() { . } static int DoSomething(string s) { Console. } } DoSomething using System. Multicast(MyString). delegate void FunctionToCall(). return 0. class MyClass { public void nonStaticMethod() { Console. return 0.

functionDelegate += MyClass. } } class MainClass { static void Main() { MyClass t = new MyClass().WriteLine("staticMethod").nonStaticMethod. functionDelegate = t. class MyClass { public void nonStaticMethod() { . } } nonStaticMethod staticMethod nonStaticMethod staticMethod using System. FunctionToCall functionDelegate. functionDelegate(). functionDelegate += t.nonStaticMethod.staticMethod. functionDelegate += MyClass.staticMethod. delegate void FunctionToCall(). Console.

} } nonStaticMethod staticMethod nonStaticMethod staticMethod using System. functionDelegate(). functionDelegate += MyClass.WriteLine("staticMethod").staticMethod. } } class MainClass { static void Main() { MyClass t = new MyClass().staticMethod. functionDelegate = t. . Console.WriteLine("nonStaticMethod"). functionDelegate += MyClass. } public static void staticMethod() { Console. FunctionToCall functionDelegate.nonStaticMethod.nonStaticMethod. functionDelegate += t. delegate int FunctionToCall().

functionDelegate += Add2. public static int Add2() { IntValue += 2. Console. . private int age. return IntValue. } public static int Add3() { IntValue += 3.WriteLine("Value: {0}".class MainClass { static int IntValue = 5. public class Person { private string name. return IntValue. public delegate string DelegateDescription(). functionDelegate()). } } Value: 12 using System. functionDelegate += Add3. } static void Main() { FunctionToCall functionDelegate = Add2.

} public string MakeAndNumber() { return(name + " is " + number + " mph"). public Person(string name. } } class MainClass { public static void Main() { Person myPerson = new Person("Price". this. this. private int number. } public string NameAndAge() { return(name + " is " + age + " years old").name = name.name = name. } } public class Employee { private string name. int number) { this. public Employee(string name. 32). int age) { this.number = number. .age = age.

WriteLine("replaceSpaces"). } } personDescription = Price is 32 years old M is 140 mph using System. class MainClass { static string replaceSpaces(string a) { Console.MakeAndNumber). string d = myDelegateDescription().WriteLine(d). } static string reverse(string a) { . string personDescription = myDelegateDescription(). myDelegateDescription = new DelegateDescription(myEmployee.NameAndAge).WriteLine("personDescription = " + personDescription). } static string removeSpaces(string a) { Console. return a. Console. delegate string StrMod(string str). DelegateDescription myDelegateDescription = new DelegateDescription(myPerson. Employee myEmployee = new Employee("M". 140). return a. Console.WriteLine("removeSpaces").

return a.WriteLine("reverseSpaces"). delegate string StrMod(string str). Console.WriteLine("replaceSpaces")."). str = strOp("This is a test. string str. strOp = new StrMod(removeSpaces).")."). } public static void Main() { StrMod strOp = new StrMod(replaceSpaces). class MainClass { static string replaceSpaces(string a) { Console. str = strOp("This is a test. return a. strOp = new StrMod(reverse). str = strOp("This is a test. } static string removeSpaces(string a) { . } } replaceSpaces removeSpaces reverseSpaces using System.

. strOp = removeSpaces.Collections.").Generic. return a. return a. using System. // use method group conversion string str. } } replaceSpaces removeSpaces reverseSpaces using System.WriteLine("removeSpaces").WriteLine("reverseSpaces"). } public static void Main() { StrMod strOp = replaceSpaces. str = strOp("This is a test. // use method group converison str = strOp("This is a test."). } static string reverse(string a) { Console. Console. // Call methods through the delegate. // use method group conversion str = strOp("This is a test."). strOp = reverse.

}). } } 3 .Runtime. delegate void FooBar().WriteLine(i). Invoke3Times(delegate { i++. public class MainClass { static void Invoke3Times(FooBar d) { d(). using System.InteropServices. d(). } public static void Main(){ int i = 0.using System.Reflection. Console. d().