Showing posts with label java program. Show all posts
Showing posts with label java program. Show all posts

Friday, June 12, 2015

GRAPH COLORING USING BACKTRACKING

AIM

To write the Java program for the implementation of graph coloring

ALGORITHM

Step 1:              Start the program and define the function

Step 2:              Create a class coloring

Step 3:              Get the number of vertices in the graph

Step 4:              Enter one if there is an edge in the graph

Step 5:              And enter zero if there is no edge in the graph.

Step 6:              Get the adjacency matrix of the given values

Step 7:              Perform all possible combinations that are given

Step 8:              Display all the combination

Step 9:              End of the program




PROGRAM

GRAPH COLORING USING BACKTRACKING
import java.io.*;
class gcoloring
{
   int a[][]=new int[10][10];
   int x[]=new int[10];      
   int m, n;      
   void read()
   {
      DataInputStream in=new DataInputStream(System.in);
      try
      {
        System.out.println("Enter number of vertices in the graph");    
        n=Integer.parseInt(in.readLine());
        System.out.println("Enter 1 if there is an edge Otherwise 0");
        for(int i=1;i<=n;i++)
         for(int j=1;j<=n;j++)
         {
            System.out.println("between "+i+" and "+j);
            a[i][j]=Integer.parseInt(in.readLine());
         }
      }
      catch(Exception e){}
        System.out.println("Given adjacency matrix is ");        
      for(int i=1;i<=n;i++)
      {
          for(int j=1;j<=n;j++)
            System.out.print(a[i][j]+"\t");
          System.out.println();
      }
      for(int i=1;i<=n;i++)
           x[i]=0;      
      for(int i=2;i<n;i++)
      {
          m=i;   
          System.out.println("All possible combinations for m = "+i+" are ");
          mcoloring(1);
      }
   }
   void mcoloring(int k)
   {   
     do
     {
       nextvalue(k);    
       if(x[k]==0) break;
       if(k==n)
       {
          for(int i=1;i<=n;i++)
             System.out.print(x[i]+"\t");
          System.out.println();
       }
       else
          mcoloring(k+1);
     }while(true);
    }

Thursday, June 11, 2015

0/1 KNAPSACK USING DYNAMIC PROGRAMMING

AIM

To write a Java program for the implementation of 0/1 knapsack using dynamic programming.

ALGORITHM

Step 1:              Start the program and define the function.

Step 2:              Initialize the weight and profit.

Step 3:              Read the number of objects that are given.

Step 4:              For each objects, print the profit and weight

Step 5:              Initializing is set to false.

Step 6:              Display and print the item weight and profit

Step 7:              Display the total cost

Step 8:              End of the program.




PROGRAM
0/1 KNAPSACK USING DYNAMIC PROGRAMMING
import java.io.*;
class objects
{
   int weight;
   int profit;
}
public class knapsack
{
    static int N,W;
    static objects st[];
    public static void main(String args[])throws IOException
    {
        DataInputStream in=new DataInputStream(System.in);
        System.out.println("Enter the number of objects:");
        N=Integer.parseInt(in.readLine());
        System.out.println("Enter the maximum weight sack can take:");
        W=Integer.parseInt(in.readLine());
        st=new objects[N+1];
        st[0]=new objects();st[0].weight=st[0].profit=0;
        for(int i=1;i<=N;i++)
        {
                st[i]=new objects();
                System.out.println("\nFor object "+i);
                System.out.print("Enter profit: ");
                st[i].profit=Integer.parseInt(in.readLine());
                System.out.print("Enter Weight: ");
                st[i].weight=Integer.parseInt(in.readLine());
        }
        int [][] opt=new int[N+1][W+1];
        boolean [][] sol= new boolean[N+1][W+1];
        for(int n=1;n<=N;n++)
        for(int w=1;w<=W;w++)
        {
            int option1=opt[n-1][w];
            int option2=-1;
            if(st[n].weight<=w)
               option2=st[n].profit+opt[n-1][w-st[n].weight];
            opt[n][w]=Math.max(option1, option2);
            sol[n][w]=(option2 > option1);
          }
        boolean take[]=new boolean[N+1];
        int prof=0;
        for(int n=N,w=W;n>0;n--)
           if(sol[n][w])
           {
             take[n]=true;
             w=w-st[n].weight;
             prof+=st[n].profit;
           }

Wednesday, June 10, 2015

CONVEX HULL

AIM

To write a Java program for the implementation of convex hull

ALGORITHM

Step1:  Start the program

Step2:  Create a class convexhullalg

Step3:  Read the number of points

Step4:  Get the x and y co-ordinate values

Step5:  Sort the values using sort function
           
Step6:  To sort two values swap the values of i and j
                                   
Step7:  Call the function display to display the boundary points

Step8:  The function check id used to check whether the point is angular or not(180▫)

Step9:  End of the program





PROGRAM
CONVEX HULL
import java.io.*;
class convexhullalg
{
        int x[],y[],n;
        boolean status[];
        void insert()
        {
              try
              {
                DataInputStream in=new DataInputStream(System.in);
                System.out.println("Enter number of points:");
                n=Integer.parseInt(in.readLine());
                x=new int[n];
                y=new int[n];
                status=new boolean[n];
                System.out.println("Enter x and y coordinates for ");
                for(int i=0;i<n;i++)
                {
                System.out.println("point "+(i+1));
                x[i]=Integer.parseInt(in.readLine());
                y[i]=Integer.parseInt(in.readLine());
                status[i]=false;
                }
               }
             catch(Exception e){}
                sort();
                check(0,'L');
                check(0,'H');
                display();
        }
        void sort()
        {
                for(int i=0;i<n-1;i++)
                {
                  for(int j=i+1;j<n;j++)
                    if((x[i]>x[j]) || ((x[i]==x[j]) && (y[i]>y[j])))
                        swap(i, j);
                }
        }
        void swap(int i,int j)
        {
                int temp=x[i];
                x[i]=x[j];
                x[j]=temp;
                temp=y[i];
                y[i]=y[j];
                y[j]=temp;
        }
        void display()
        {
                System.out.println("Boundary points are");
                for(int i=0;i<n;i++)
                   if(status[i]==true)
                        System.out.println("("+x[i]+", "+y[i]+")");

        }
        void check(int p,char c)
        {
                double slope=0,degree=0,deg=0;
                int next=0;
                status[p]=true;
                for(int i=p+1;i<n;i++)
                {
                 try
                 {
                   slope=(double)(x[i]-x[p])/(double)(y[i]-y[p]);
                   degree=Math.toDegrees(Math.atan(slope));
                   if(degree < 0)
                      degree+=180;
                 }

Tuesday, June 9, 2015

Quick Sort

AIM

To write a Java program for the implementation the quick sort

ALGORITHM

Step1   :start the program

Step2:  declare and initialize the array size

Step3:  enter the number of elements to be quick sorted.

Step4:  enter the elements using for loop

Step5:  call the function quick(1,noe)
            Void quick(int first,int last)

Step6:  if the first element is less than the last
(a)    then the first element is taken as the pivot &i=first, &j=last
(b)   the condition is checked for i<j if true

Step7:  set a loop to check the elements
            (a)while (a[pivot]>=a[i]&&i<last)i++;
            (b)while (a[pivot]>=a[j]&&j>first)j--;

Step8:  if (i>j)
            Swap(i,j)

Step9:  sort the elements and display the sorted values.




PROGRAM
Quick Sort
import java.io.*;
class quicksortalg
{
   int noe;
   int[] a=new int[100];
    public void sort()
   {
           try
           {
                    System.out.println("Enter the number of elements:");
                    DataInputStream din=new DataInputStream(System.in);
                    noe=Integer.parseInt(din.readLine());         
                   System.out.println("Enter the elements:");
                   for(int i=1;i<=noe;i++)
                   a[i]=Integer.parseInt(din.readLine());
                    System.out.println("The array:");
                  display();
           }
           catch(Exception e){}
           quick(1,noe);
  }
   public void swap(int i,int j)
  {
     int t;
     t=a[i];a[i]=a[j];a[j]=t;
  }
 public void quick(int first,int last)
  {
    if(first<last)
    {
      int pivot=first;
      int i=first;
      int j=last;
      while(i<j)
      {     
         while(a[pivot]>=a[i] && i<last) i++;
         while(a[pivot]<=a[j] && j>first) j--;
         if(i<j) swap(i,j);
       }
      swap(pivot,j);
      quick(first,j-1);
      quick(j+1,last);
    }
  }

Monday, June 8, 2015

TRIES

AIM

To implement the tries with insert & delete operations using Java.


ALGORITHM

Step 1:              Start the program by defining the functions.

Step 2:               First initialize the node to null

Step 3:              to find the particular element use function find
check the element to root node, if it is not found check for left or right side of the root. If its found return the element

Step 4:              to insert the particular element read that elemnt and
insert the element with tag as 0 and level as 1.

Step 5:              to display the elements ,display if root as null, print as
empty, otherwise call empty

Step 6:              print the current node in left sub tre in the format as currentnode.data + level and tag.

Step 7:              display current node in the right sub tree

Step 8:              end of the program



PROGRAM
TRIES
import java.io.*;
class node
{
public int tag,level;    
    starts with 1
    public int data;           
    public node LC,RC,par;     
}
class trie
{
      public node cptr;
        public node root=null;
        public node find(int key)
      {
            int item=key;
            node temp=root;
            while(temp!=null)  
            {
                  cptr=temp;
                  if(temp.tag==1)   
                  {
                        if((item & 1)==0)
                        {
                              temp=temp.LC;
                              item=item >> 1;
                        }
                        else
                        {
                              temp=temp.RC;
                              item=item >> 1;
                        }
                  }
                  else   
                  {
                        if(key==temp.data)
                        {
                              return temp;
                        }
                        else break;
                  }
            }
            return null; 
      }
      public void insert()
      {
            int key=0;
                try
                {
                System.out.println("Enter the element:");
                DataInputStream din=new DataInputStream(System.in);
                key=Integer.parseInt(din.readLine());
                }
                catch(Exception e){}
           
            if(root==null)
            {
                  root=new node();
                  root.data=key;
                  root.tag=0;
                  root.level=1;
                  root.par=null; root.LC=null; root.RC=null;
            }

Sunday, June 7, 2015

B-TREE

AIM

To implement the b-tree with insert and delete operations using Java.

ALGORITHM

Step 1:                    Start the program by defining function.

Step 2:                    Declare the class btree

Step 3:                    The insert and delete operations are performed

Step 4:                    To insert, check if root is empty, if it is empty
                     insert the element as root.
                
Step 5:                    If it is greater insert it into right sub tree.

Step 6:                    Otherwise, insert it into left sub tree

Step 7:                    Use the function split, to split the nodes

Step 8:                    Call the function display to display
                     data1,data2,address and parent

Step 9:                    End of the program




PROGRAM
B-TREE
import java.io.*;
class bnode
{
        int data1,data2;
        bnode lptr,mptr,rptr,parent;
        public void bnode()
        {
                this.data1=this.data2=0;
                this.lptr=this.mptr=this.rptr=this.parent=null;
        }

}
class btree
{
        bnode root=null;
        bnode p,p1;
        bnode prev;
        void insert(int ele)
        {
                bnode temp=new bnode();
                temp.data1=ele;
                if(root==null)
                {
                        root=temp;

                }
                else
                {
                       p1=root;
                       while(p1!=null)
                       {
                       prev=p1;
                       if(temp.data1<p1.data1)
                       p1=p1.lptr;
                       else if((temp.data1>p1.data1) &&(temp.data1<p1.data2))                                                           
                       p1=p1.mptr;
                       else
                       p1=p1.rptr;
                 }
                       p1=prev;
                       while(p1!=null)
                       {
                               if(p1.data2==0)
                                {
                                        if(temp.data1<p1.data1)
                                        {
                                                int t=p1.data1;
                                                p1.data1=temp.data1;
                                                p1.data2=t;
                                                p1.lptr=temp.lptr;
                                                if(temp.lptr!=null)
                                                temp.lptr.parent=p1;                                           
                                                p1.mptr=temp.rptr;
                                                if(temp.rptr!=null)
                                                 temp.rptr.parent=p1;
                                        }
                                        else
                                        {
                                                p1.data2=temp.data1;
                                                p1.mptr=temp.lptr;
                                                if(temp.lptr!=null)
                                                temp.lptr.parent=p1;
                                                p1.rptr=temp.rptr;
                                                if(temp.rptr!=null)
                                                temp.rptr.parent=p1;
                                        }
                                        temp.parent=p1.parent;
                                        break;
                                }
                                else if((p1.data1!=0) && (p1.data2!=0))
                                {
                                        p1=split(temp,p1);
                                        temp=p1;
                                        p1=p1.parent;

                                }
                        }

                }
              display(root);
        }

Saturday, June 6, 2015

LEFTIST HEAP

AIM

To implement the leftist heap with insert and deletemin operation using Java.


ALGORITHM

Step 1:              Start the program by defining function.

Step 2:              We know heap as the root node with minimum element.

Step 3:              The insert and delete operations are performed with the help of combining 2 trees.

Step 4:              The insert operation is performed by combining the two leftist trees.

Step 5:              The deletemin() is used to delete the minimum element in the heap.

Step 6:              After the insert and delete operations leftist heap elements are displayed.

Step 7:              Stop the program.




PROGRAM
LEFTIST HEAP
import java.io.*;
class node
{
      public int data;
      public node LC,RC;
      public int shortest;
}
class minleftist
{    
      node root = null;
      public void insert()
      {
                int newelt=0;
                try
                {
                System.out.println("Enter the element:");
                DataInputStream din=new DataInputStream(System.in);
                newelt=Integer.parseInt(din.readLine());
                }
                catch(Exception e){}
                node temp = new node();
                temp.data=newelt;
                temp.LC=temp.RC=null;
                temp.shortest=1;
                if(root==null)
                root=temp;
                else
                root=meld(root,temp);
      }
      public node meld(node  a, node  b)
      {
            if(a.data > b.data)
            {
                  node  t;
                  t=a;
                  a=b;
                  b=t;
            }
            if(a.RC==null)
                  a.RC=b;
            else
                  a.RC=meld(a.RC,b);
            if((a.LC==null) || (a.LC.shortest < a.RC.shortest))
            {
                  node  t=new node();
                  t=a.LC;
                  a.LC=a.RC;
                  a.RC=t;
            }
            if(a.RC==null)
                  a.shortest=1;
            else
                  a.shortest=a.RC.shortest+1;
            return a;
      }
      public void remove()
      {
            System.out.println("Deleted element is "+root.data+"\n");
            root=meld(root.LC,root.RC);
      }
      public void display()
      {
            if(root==null)
                   System.out.println("EMPTY");
                else
                {
                System.out.println("\nIn Order");
                dispin(root);
                }
      }
      public void dispin(node currentnode)
      {
            if(currentnode!=null)
             {
            dispin(currentnode.LC);
System.out.println(currentnode.data+" "+"SHORTEST "+currentnode.shortest);
            dispin(currentnode.RC);
             }
        }

};

Friday, June 5, 2015

DEAPS

AIM

To implement program for deaps structure with insert and delete operations using Java.



ALGORITHM

Step 1:              Start the program by creating Deap Structure.

Step 2:              Perform insert and delete functions.

Step 3:              The insert() is done with 2 methods namely maxinsert() and mininsert().

Step 4:              The delete() is done with 2 methods namely deletemax() and deletemin()

Step 5:              The leftChild and rightChild are compared and the appropriate element is placed in the root node.

Step 6:              After the insert and delete operation Deap elements are displayed.

Step 7:              Stop of the program.




PROGRAM

DEAPS
import java.io.*;
class deapsalg
{
    int maxsize=100,size;
    int[] h=new int[maxsize+1]; 
    public int leftchild(int i)
    {
          return 2*i;
    }
    public int rightchild(int i)
    {
          return 2*i + 1;
    }
    public int parent(int i)
    {
          return i/2;
    }
    public boolean isleaf(int i)
    {
       return ((i<=size) && (i>size/2));  
    }
    public void swap(int i,int j)
    {
          int t;
          t=h[i];h[i]=h[j];h[j]=t;
    }
    public void display()
    {
         System.out.println("The deaps elements are:");
         for(int i=1;i<=size+1;i++)
            System.out.println("\n"+h[i]);
    }
    public int MaxHeap(int i)
    {
        int t=i;
        while(t!=2 && t!=3)
          t=t/2;
        if(t==2)
        {      
          return 0;
        }
        else
        {         
          return 1;
        }
    }
    public int MinPartner(int p)
    {
          int powvalue=(int) ((Math.floor(Math.log(p)/Math.log(2)))-1);        
          int partner=p-(int)(Math.pow(2,powvalue));
          return partner;
    }

    public int MaxPartner(int p)
    {
          int powvalue=(int) ((Math.floor(Math.log(p)/Math.log(2)))-1);
          int partner=p+(int)(Math.pow(2,powvalue));     
          if(partner>size+1)
             partner/=2;          
          return partner;
    }
    public void MinInsert(int  i)
    {
         while (parent(i)!=1 && (h[parent(i)]>h[i]))
         {
            int par=parent(i);
            swap(par,i);
            i=par;
         }
    }
    public void MaxInsert(int  i)
    {
         while (parent(i) !=1 && (h[parent(i)]<h[i]))
         {
            int par=parent(i);
            swap(par,i);
            i=par;
         }
    }
    public void insert()  
    {
        int newelt=0;
        size++;    
        if(size>maxsize)
          System.out.println("Deap full");
        else
        {
          try
           {
              System.out.println("Enter the element:");
              DataInputStream din=new DataInputStream(System.in);
              newelt=Integer.parseInt(din.readLine());
           }
           catch(Exception e){}

           if(size==1)
           {
             h[2]=newelt;
            return;
           }
           int p=size+1;
           h[p]=newelt;
           switch(MaxHeap(p))
           {
              case 1:
                   int partner=MinPartner(p);               
                   if(h[partner]>h[p]) 
                   {
                       swap(p,partner);
                       MinInsert(partner);
                   }
                   else
                      MaxInsert(p);
                   break;
              case 0: 
                   partner=MaxPartner(p);
                   if(h[partner]<h[p]) 
                   {
                       swap(p,partner);
                       MaxInsert(partner);
                   }
                   else
                      MinInsert(p);
                   break;
             default:
                   System.out.println("ERROR");
            }
      }
  }

Thursday, June 4, 2015

MIN HEAP

AIM

To implement the min heap structure with insert and delete minimum operation using Java program

  
ALGORITHM

Step 1:              start the program by creating function with min heap property

Step 2:              two functions namely insert() and deletemin() are created

Step 3:              the insert() is used to insert new element in the tree structure with heap property.

Step 4:              The deletemin() is used to delete the minimum element which is usually a root node.

Step 5:              The two operations are performed satisfying heapness and completeness property.

Step 6:              End of the program.


PROGRAM:
MIN HEAP

import java.io.*;
class heapalg
{
    int maxsize=100,size;
    int[] h=new int[maxsize];  
    public int leftchild(int i)
    {
          return 2*i;      
    }
    public int rightchild(int i)
    {
          return 2*i + 1;
    }   
    public int parent(int i)
    {
          return i/2;
    }
    public boolean isleaf(int i)
    {
       return ((i<=size) && (i>size/2));     
    }
    public void swap(int i,int j)
    {
          int t;
          t=h[i];h[i]=h[j];h[j]=t;
    }
    public void display()
    {
         System.out.println("The heap elements are:"+"\n");
         for(int i=1;i<=size;i++)
            System.out.println("\n"+h[i]);
    }    
    public void insert()  
    {     
        size++;
        if(size>maxsize)
          System.out.println("Heapfull");
        else
        {
           try
           {
              System.out.println("Enter the element:");
              DataInputStream din=new DataInputStream(System.in);
              h[size]=Integer.parseInt(din.readLine());
           }
           catch(Exception e){}
           insertelt(size);
        }
    }
    public void insertelt(int  i)  
    {
  while ((h[parent(i)]>h[i]))
{
            int par=parent(i);
            swap(par,i);
            i=par;
         }
    }
    public void delete()
    {      
          if(size==0)
            System.out.println("Heapempty");
           else
           {
            System.out.println("The deleted min elt:"+h[1]);
            h[1]=h[size--];
            if(size!=0)
              percolate(1);
           }     
     }
   public void percolate(int i)
   {
       while(!isleaf(i))
       {
          int small=leftchild(i);    
          if( (small<size)&& h[small] > h[small+1])
             small+=1;
          if(h[small] < h[i]) 
                swap(small,i);
          i=small;
      }
  }

Tuesday, May 26, 2015

AVL TREE

AIM

To implement the AVL tree with insert & delete operations using Java.

ALGORITHM

Step 1:              Start the program by defining the functions.

Step 2:              Insert the elements to the AVL tree.

Step 3:              Check the tree if it is balanced or not.

Step 4:              The balance factor is one of 0, 1 and -1.

Step 5:              If it is not balanced, balance the tree using
(i)           Left-left
(ii)         Left-right
(iii)       Right-left
(iv)       Right-right
Balancing

Step 6:              And if the tree is balanced and then the insert() and the delete() operations are performed.

Step 7:              Stop the program.





PROGRAM
AVL TREE
import java.io.*;
class node
{
      public int data;
      public node LC,RC;
      public int bf;
}
class avltree
{    
      node root = null;
      public boolean insert()
      {
                int newelt=0;
                try
                {
                System.out.println("Enter the element:");
                DataInputStream din=new DataInputStream(System.in);
                newelt=Integer.parseInt(din.readLine());
                }
                catch(Exception e){}
            if(root==null)
            {
                  node y=new node();
                  y.data=newelt;
                  y.bf=0;
                  y.LC=null;
                  y.RC=null;
                  root=y;
                  return true;
              }
            node f,a,q,p;        
            node b,c;            
            int d;               
            node y=new node();
            boolean found, unbalanced;
            f=null;
            a=root;
            p=root;
            q=null;
            found=false;
            while (p!=null && found!=true)
            {
                  if(p.bf!=0) {a=p;f=q;}
                  if(newelt<p.data){q=p;p=p.LC;}
                  else if(newelt>p.data){q=p;p=p.RC;}
                  else {y=p;found=true;}
            }          
            if(found==false)
                {
                  y.data=newelt;
                  y.bf=0;
                  y.LC=null;
              y.RC=null;
         if(newelt<q.data)
                  q.LC=y;
         else
                  q.RC=y;                 
         if(newelt >a.data)
                  {p=a.RC;b=p;d=-1;}
         else    
                  {p=a.LC;b=p;d=1;}
         while(p!=y)
         {
                  if(newelt > p.data)
                        {p.bf=-1;p=p.RC;}
                  else
                        {p.bf=1;p=p.LC;}
         }       
         unbalanced=true;
         if((a.bf==0)||((a.bf+d)==0))
                  {a.bf+=d;unbalanced=false;}    
         if(unbalanced==true)
         {
           if(d==1)
            {
            if(b.bf==1)
            {
                  System.out.println("LL imbalance");
                  a.LC=b.RC;
                  b.RC=a;
                  a.bf=0;
                  b.bf=0;
            }
            else
            {
                  System.out.println("LR imbalance");
                  c=b.RC;
                  b.RC=c.LC;
                  a.LC=c.RC;
                  c.LC=b;
                  c.RC=a;

Monday, January 20, 2014

/* Program to Implement Hierarchical Inheritance in java Programming Language */
class Info
{
int pid;
char branch;
char year;
}

Info(int p,char ch,char y)
{
pid = p;
branch = ch;
year = y;
}

void display()
{
System.out.println("\nPID\t: "+pid);

System.out.print("Branch\t: ");
if(branch == 'i')
System.out.println("Information Technology");
if(branch =='e')
System.out.println("Electronics and Telecommunication");
if(branch =='c')
System.out.println("Computer Science");

System.out.print("Year\t: ");
if(year == 'f')
System.out.println("FE");
if(year == 's')
System.out.println("SE");
if(year == 't')
System.out.println("TE");
}
}

class Fe extends Info
{
int c;
int cpp;

Fe(int p,char ch,char y,int m1,int m2)
{
super(p,ch,y);
c = m1;
cpp = m2;
}

void fdisplay()
{
display();
System.out.println("Performance:");
System.out.println("\tC\t"+c);
System.out.println("\tC++\t"+cpp);
}
}

class Se extends Info
{
int vb;
int html;

Se(int p,char ch,char y,int m1,int m2)
{
super(p,ch,y);
vb = m1;
html= m2;
}

void sdisplay()
{
display();
System.out.println("Performance:");
System.out.println("\tVB\t"+vb);
System.out.println("\tHTML\t"+html);
}
}

class Te extends Info
{
int matlab;
int java;

Te(int p,char ch,char y,int m1,int m2)
{
super(p,ch,y);
matlab = m1;
java = m2;
}
void tdisplay()
{
display();
System.out.println("Performance:");
System.out.println("\tMATLAB\t"+matlab);
System.out.println("\tSJava\t"+java);
}
}

class Language
{
public static void main(String args[])
{
Fe F = new Fe(1074,'i','f',9,8);
Se S = new Se(1064,'e','s',6,8);
Te T = new Te(1054,'c','t',9,9);
F.fdisplay();
S.sdisplay();
T.tdisplay();
}
}