0% found this document useful (0 votes)
40 views4 pages

Awp PR 2

The document outlines practical exercises for a T.Y.BSCIT student named Shoeb S. in the subject of Advanced Web Programming. It includes three practical applications demonstrating boxing and unboxing, addition and subtraction using delegates, and the use of interfaces with animal sounds. Each practical is accompanied by a code snippet and an output section, along with a grading format at the end.

Uploaded by

Waqar kachchi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views4 pages

Awp PR 2

The document outlines practical exercises for a T.Y.BSCIT student named Shoeb S. in the subject of Advanced Web Programming. It includes three practical applications demonstrating boxing and unboxing, addition and subtraction using delegates, and the use of interfaces with animal sounds. Each practical is accompanied by a code snippet and an output section, along with a grading format at the end.

Uploaded by

Waqar kachchi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Name : Shoeb S.

Sem: V Roll No : 23DBIT02


Class : T.Y.BSCIT
---------------------------------------------------------------------------------------------------------
Practical 2a Subject: AWD

AIM : Create a simple application to demonstrate the concepts boxing and


unboxing.

❖ Program :
using System;
namespace Prac2a
{
internal class Program
{
static void Main(string[] args)
{
int num = 2020;
object obj = num;
num = 100;
System.Console.WriteLine("Value - type of num is : {0}", num);
System.Console.WriteLine("Object - type value of obj is
{0}", obj); Console.ReadLine(); int i =
(int)obj;
System.Console.WriteLine("Value - type of num is : {0}", i);
System.Console.WriteLine("Object - type value of obj is {0}", obj);
Console.ReadLine();

}}}

❖ Output:
Practical 2b

AIM : Create a simple application to perform addition and subtraction using


delegate

❖ Program :
using System;
namespace Prac2b
{
internal class Program
{
public delegate int Operation(int x, int
y); static void Main(string[] args)
{
Operation addOperation = new Operation(Add);
Operation subtractOperation = new
Operation(Subtract); int a = 2; int b = 5;
int additionResult = addOperation(a, b);
Console.WriteLine($"Addition of {a} and {b} =
{additionResult}"); int subtractionResult =
subtractOperation(a, b);
Console.WriteLine($"Subtraction of {a} and {b} =
{subtractionResult}"); Console.ReadKey();

}
static int Add(int x, int y)

{ return
x + y;
}
static int Subtract(int x, int y) { return x - y; }
}
}

❖ Output:

Practical 2c

AIM : Create a simple application to demonstrate use of the concepts of


interfaces.

❖ Program :

using System;
namespace Prac2c
{
public interface Animal
{
void MakeSound();
}
public class Dog : Animal
{
public void MakeSound()
{
Console.WriteLine("Dog says: Woof!");
}
}

// Implementing the Animal interface in the Cat


class public class Cat : Animal
{
public void MakeSound()
{
Console.WriteLine("Cat says: Meow!");
}
}
internal class Program
{
static void Main(string[] args)
{
Animal myDog = new Dog();
Animal myCat = new Cat();
myDog.MakeSound();
myCat.MakeSound();
Console.ReadLine();
}
}
}

❖ Output:

--------------------------------------------------------------------------------------------------------------------------------------

“ AIKTC Panvel ”
BSC IT Department
Subject : Advanced Web Programming
Lab Activity in Practical 2

Marks obtained Signature


Product Process Total (25)
Related (15) Related (10)

You might also like