











































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!












































❒ Summative Feedback: ❒ Resubmission Feedback:
using System; namespace new { class Program { static void Main(string[] args) { Console.Write("Enter Number: "); int n = int.Parse(Console.ReadLine()); Double so = Math.Sqrt(n); if (so * so == n) { Console.WriteLine("Square numbers"); } else { Console.WriteLine("Not Square numbers"); } Console.ReadKey(); } } }
2. OBJECT-ORIENTED PROGRAMMING
- Class (Class)
Figure 4 : Example
Figure 5 : Encapsulation
class Program { int x; public Program(int iX) { this.x = iX; } public void MySquare() { int Calc = x * x; Console.WriteLine(Calc); } static void Main(string[] args) { customer obj = new customer ( 20 ); obj. MySquare(); } }
public abstract class Employee { public virtual void LeaderName() { } } public class hrDepart : Employee { public override void LeaderName() { Console.WriteLine("Mr. jone"); } } public class itDepart : Employee { public override void LeaderName() { Console.WriteLine("Mr. Tom"); } } public class financeDepart : Employee { public override void LeaderName() { Console.WriteLine("Mr. Linus"); } } class PolymorphismDemo {
static void Main(string[] args) { hrDepart obj1 = new hrDepart (); itDepart obj2 = new itDepart (); financeDepart obj3 = new financeDepart (); obj1.LeaderName(); obj2.LeaderName(); obj3.LeaderName(); Console.ReadKey(); } }
- ABSTRACT CLASSES
- EXAMPLE:
//abstract class public abstract class Employess { //abstract method with no implementation public abstract void displayData(); } //derived class public class test : Employess { //abstract class method implementation
- EXAMPLE: // interface public interface xyz { void methodA(); void methodB(); } // interface method implementation class test : xyz { public void methodA() { Console.WriteLine("methodA"); } public void methodB() { Console.WriteLine("methodB"); } } class interfaceDemo { static void Main(string[] args) { test obj = new test (); obj.methodA(); obj.methodB(); } }
public interface xyz { void methodA(); void methodB(); }
public interface abc : xyz { void methodC(); }
3. EVENT-DRIVEN PROGRAMMING
Console.WriteLine(String.Format("{0} notified about the GPA {1}", Name, pGPAScore.ToString())); } }
4. RELATIOSHIP BEETWEN POP, OOP, EDP
Figure 6 : Use Case Diagram