Saturday, October 24, 2015

Measurement Scales Converter in vb.net


Vb.net Code:-

Public Class WebForm1
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim a As Single
        Dim b As Single

        Dim c As Single
        Dim inch As Single
        Dim yard As Single
        Dim meter As Single
        Dim fathom As Single
        Dim rod As Single
        Dim furlong As Single
        Dim kilometer As Single
        Dim mile As Single
        Dim foot As Single
        yard = 3
        meter = 3.28155
        fathom = 6
        rod = 16.5
        furlong = 660
        kilometer = 32815
        mile = 5280
        If Val(TextBox1.Text) = 1 Then
            a = inch
        End If
        If TextBox1.Text = 2 Then
            a = yard
        End If
        If TextBox1.Text = 3 Then
            a = meter
        End If
        If TextBox1.Text = 4 Then
            a = fathom
        End If
        If TextBox1.Text = 5 Then
            a = rod
        End If
        If TextBox1.Text = 6 Then
            a = furlong
        End If
        If TextBox1.Text = 7 Then
            a = kilometer
        End If
        If TextBox1.Text = 8 Then
            a = mile
        End If
        If Val(TextBox2.Text) = 1 Then
            b = inch
        End If
        If TextBox2.Text = 2 Then
            b = yard
        End If
        If TextBox2.Text = 3 Then
            b = meter
        End If
        If TextBox2.Text = 4 Then
            b = fathom
        End If
        If TextBox2.Text = 5 Then
            b = rod
        End If
        If TextBox2.Text = 6 Then
            b = furlong
        End If
        If TextBox2.Text = 7 Then
            b = kilometer
        End If
        If TextBox2.Text = 8 Then
            b = mile
        End If
        c = Val(TextBox3.Text) * a

        Dim ans As Integer

        ans = c / b
        TextBox4.Text = ans




    End Sub
End Class




Form:-



HTML CODE:-

Monday, October 5, 2015

Polymorphism in C# : Code

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

namespace ConsoleApplication5
{
    class Shape
    {
        protected int width, height;
        public Shape()
        {
        }
        public virtual void area(int width, int height)
        {
            Console.WriteLine("Parent class area :");
            Console.WriteLine("Shape has no spasific area ");
        }
    }

    class Rectangle : Shape
    {
        public Rectangle() : base()
        {

        }
        public override void area(int width, int height)
        {
            Console.WriteLine("Rectangle class area :");
            Console.WriteLine(width * height);
        }
    }
   
    class Triangle : Shape
    {
        public Triangle() : base()
        {

        }
        public new void area(int width,int height)
        {
            Console.WriteLine("Triangle class area :");
            Console.WriteLine(width * height / 2);
        }
    }
   
    class Tester
    {

        static void Main(string[] args)
        {
            Shape s = new Shape();
            Rectangle r = new Rectangle();
            Triangle t = new Triangle();
            s.area(0,0);
            r.area(10,7);
            t.area(10,5);

            Shape s1 = new Rectangle();
            s1.area(10, 15);

            Shape s2 = new Triangle();
            s2.area(22, 76);

            Console.ReadKey();
        }
    }
}

Thursday, September 24, 2015

Multilevel Inheritance and Function Overriding in Java

package oop;
public class Oop {

    public static class A{
        void func(){
            System.out.println("Function of A");
        }
    void func1(){
            System.out.println("Function of A");
        }
    }
    public static class B extends A{
        void func(){
            System.out.println("Function of B");
        } 
    void func1(){
        super.func1();
            System.out.println("Function of B");
        }    
    }
    public static class C extends B{
        void func(){
            System.out.println("Function of C");
        }        
    void  func1(){
        super.func1();
            System.out.println("Function of C");
        }
    }
    public static void main(String[] args) {
     
     
        C obj4=new C();
        obj4.func();
        obj4.func1();
    }
    }


Sunday, September 13, 2015

Interface /Abstract Classes in C++

An interface describes the behavior or capabilities of a C++ class without committing to a particular implementation of that class.
The C++ interfaces are implemented using abstract classes and these abstract classes should not be confused with data abstraction which is a concept of keeping implementation details separate from associated data.
A class is made abstract by declaring at least one of its functions as pure virtual function. A pure virtual function is specified by placing "= 0" in its declaration as follows:



#include <iostream.h>

class Shape

{

public:

// pure virtual function providing interface framework.

virtual int getArea() = 0;

void setWidth(int w)

{

width = w;

}

void setHeight(int h)

{

height = h;

}

protected:

int width;

int height;

};



class Rectangle: public Shape

{

public:

int getArea()

{

return (width * height);

}

};

class Triangle: public Shape

{

public:

int getArea()

{

return (width * height)/2;

}

};



int main(void){

Rectangle Rect;

Triangle Tri;

Rect.setWidth(5);

Rect.setHeight(7);

cout << "Total Rectangle area: " << Rect.getArea() << endl;

Tri.setWidth(5);

Tri.setHeight(7);

cout << "Total Triangle area: " << Tri.getArea() << endl;

return 0;

}

Interfaces in C#

An interface is defined as a syntactical contract that all the classes inheriting the interface should follow. The interface defines the 'what'part of the syntactical contract and the deriving classes define the 'how'part of the syntactical contract.
Interfaces define properties, methods, and events, which are the members of the interface. Interfaces contain only the declaration of the members. It is the responsibility of the deriving class to define the members. It often helps in providing a standard structure that the deriving classes would follow.
Abstract classes to some extent serve the same purpose, however, they are mostly used when only few methods are to be declared by the base class and the deriving class implements the functionalities.



using System;
namespace ArrayApplication
{
    public interface person{
         void name(string n);
         void age(int a );
         void clas(int c);
    }
   
    public class usman : person{
    public  void name(string n){
        Console.WriteLine("Usman name= "+n);
    }
    public void age(int a){
        Console.WriteLine("Usman age= "+a);
    }
    public void clas(int c){
        Console.WriteLine("Usman class= "+c);
    }
    }
   
    public class usama : person{
    public void name(string n){
        Console.WriteLine("Usman name= "+n);
    }
    public void age(int a){
        Console.WriteLine("Usman class= "+a);
    }
    public void clas(int c){
        Console.WriteLine("Usman class= "+c);
    }  
    }
   
   public class test
   {
       public static void Main(String[] args){
           usama obj=new usama();
           obj.name("Usama hussain");
           obj.age(20);
           obj.clas(10);
         
           usman obj1=new usman();
           obj1.name("Usman Siddique");
           obj1.age(21);
           obj1.clas(09);
       }
   }
}

=========================================
using System;
namespace ArrayApplication
{
    public interface abc{
         void fun();
              }

   public class MyArray : abc
   {
                                                         public void fun(){
                                                        Console.WriteLine("this is defination of interface fun");
                                                       }
                                                       static void Main(string[] args){
                                                       MyArray obj=new MyArray();
                                                      obj.fun();
                                                      }    }    }
       
   

Inheritance in C#

using System;
namespace ArrayApplication
{
    class abc{
        public void fun(){
            Console.WriteLine("This is A function of base class abc");
        }
    }
   class MyArray : abc  
   {
       static void Main(string[] args)
      {
         MyArray obj=new MyArray();
         obj.fun();
      }
   }
}

Argument / Parameter passing in C# Functions

using System;
namespace ArrayApplication
{
   class MyArray
   {
       public MyArray(){
           Console.WriteLine("Construtor Invoke");
       }
       public void myfun(int a){
           Console.WriteLine("User Pass the value = "+a);
       }
      static void Main(string[] args)
      {
         MyArray obj=new MyArray();
         obj.myfun(20);
       
      }
   }
}

Functions in C#

using System;
namespace ArrayApplication
{
   class MyArray
   {
       public MyArray(){
           Console.WriteLine("Construtor Invoke");
       }
       public void myfun(){
           Console.WriteLine("Its a funtion under My Array class");
       }
      static void Main(string[] args)
      {
         MyArray obj=new MyArray();
         obj.myfun();
       
      }
   }
}

Object Creation and Constructor in C#

using System;
namespace ArrayApplication
{
   class MyArray
   {
       public MyArray(){
           Console.WriteLine("Construtor Invoke");
       }
      static void Main(string[] args)
      {
         MyArray obj=new MyArray();
       
      }
   }
}

Create a table in C#

using System;
namespace ArrayApplication
{
   class MyArray
   {
      static void Main(string[] args)
      {
         int no,i;
         no=5;
         for(i=1;i<=10;i++){
             Console.WriteLine(no+" * "+i+" = "+no*i);
         }
      }
   }
}

Hello World in C#

using System;
namespace ArrayApplication
{
   class MyArray
   {
      static void Main(string[] args)
      {
         Console.WriteLine("Helo World...Its my First C# Program");
      }
   }
}


Saturday, September 12, 2015

Constructor and Object in Java

Different Types Of Constructor in Java ... Default Constructor,Pramiterized Constructor ,,Over-loaded Constructor:-

package oop;
public class Oop {

    public int ID;
    public String name;
    public char bloodgroup;
   
    Oop(){
        System.out.println("This is the Default Constructor");
    }
    Oop(int a){
        System.out.println("This is a prametrized Constructor No= "+a);
    }
    Oop(String a){
        System.out.println("This is an other Constructor name= "+a);
    }
   
    public static void main(String[] args) {
        Oop obj1=new Oop();
        Oop obj2=new Oop(2015);
        Oop obj3=new Oop("3rd Constructor");
       
        obj1.ID=34;
        obj1.name="usman";
        obj1.bloodgroup='a';
               
    }
}

=================================
package usman1;
public class Usman1 {
    int age;
    String name;
    public Usman1(int a,String b){
age=a;
name=b;
System.out.println("Name= "+name+" age= "+age);
    }
    public static void main(String[] args) {
     Usman1 obj=new Usman1(20,"Usman Siddique");
    }  
    }

Tuesday, September 8, 2015

5th Semester E-Books BSE-5

DLD (Digital Logic and Computer Design)  

by Morris Mano 4th edition .pdf


Click Here:-



*************************

OPERATING SYSTEM CONCEPTS 9th Edition .pdf

ABRAHAM SILBERSCHATZ
 Yale University
PETER BAER GALVIN
 Pluribus Networks 
GREG GAGNE 
Westminster College

Click Here:-