Sick Week end ): :(

Oh my my,

                   Did i have a week end . Hmm i dont think so . I was busier these two days . All started today at eight thirty got up called my other half . Suprised . Woke up at ten fifty . Brushed . Was in h/w fr some time . Then started browsing fr tat stupid crystal reports . Went to eat had a cool lunch (in mess). Got ready fr te prayer meeting . Then went there . Wow so many people . Came back to room at six thiry . Hve 2 pgms in c# to complete . Was no i mood . Had some kinda weird feeligs . Had dinner . then did a cool pgm for interfaces . I really enjoyed it . am attaching tat file too . Then started my infx to post fix . finished my record and obse . had another x attack . handled in a diff way . my head was rolling when i was doing te pgm . finally got perfect o/p . spent a long time fixing one small bug . also duid evaluaytion . had pblms in retreving data . solved it easily . tats how my week end ended . hope 2morrow will be hols . any way am prepared fr it . Tats it fr te day . am tired and worn outtt . Bye

 Thought fr te day :- Love those who love u .

Rating :-6.4 (am happy cos i finished te pgms so will give 7.1)

      
  *************************************************
  **                                                                                 ** 
  **       INFIX–>POSTFIX Conversion and Evaluation           **
  **                                                                                 **
  *************************************************

using System.Collections;
using System;

namespace infi
{

 class Class1
 {
  static void Main(string[] args)
  {
   Console.Write(“Enter an Expression :”);
   string exp=Console.ReadLine();
   char[] post=new char[20];
   char b=’ ‘,c,d;

   int i=0,j=0,k=0;
   Stack stack1=new Stack();
   stack1.Push(‘#’);

   while(exp[i]!=’#’)
   {
    b=(char)stack1.Peek();
    c=exp[i];
    if(c>48 && c<58)
    {
     post[j++]=c;
    }
    
    else
    {
     if(c==’+’ || c==’-‘)
     {
      if(b!='(‘ && b!=’#’ && b!=’)’)
      {
       post[j++]=(char) stack1.Pop(); 
       stack1.Push(c);
      }
      else
      {
       stack1.Push(c);
      }
     } 
     else if(c==’/’ || c==’*’)
     {
      if(b==c)
      {
       post[j++]=(char)stack1.Pop();
       stack1.Push(c);
      }
      else
      {
       stack1.Push(c);
      }

     }
     else if(c=='(‘)
     {
      stack1.Push(c);
     }
     else if(c==’)’)
     {
      char z=(char)stack1.Pop();
      while(z!='(‘)
      { 
       post[j++]=z;
       z=(char)stack1.Pop();
      }

     }
     
    }
    
    i++; 
   }
   b=(char)stack1.Pop(); 
   if(exp[i]==’#’ && b!=’#’)
   {
    while(b!=’#’)
    {
     post[j++]=b;
     b=(char)stack1.Pop();
    }
   }

   Console.WriteLine(post);
   post[j]=’#’;

   //Postfix evaluation starts here
   
   stack1.Clear();
   string temp;
   i=0;j=0;k=0;
   while(post[i]!=’#’)
   {
    c=post[i];
    if(post[i]>48 && post[i]<58)
    {
     temp=c.ToString();
     int z=int.Parse(temp);
     stack1.Push(z);
    }
    else
    {
     int c1=(int)stack1.Pop();
     int b1=(int)stack1.Pop();
     if(post[i]==’+’)
     {
      c1=c1+b1;
      stack1.Push(c1);
     }
     else if(post[i]==’/’)
     {
      c1=c1/b1;
      stack1.Push(c1);
     }
     else if(post[i]==’-‘)
     {
      c1=c1-b1;
      stack1.Push(c1);
     }
     else if(post[i]==’*’)
     {
      c1=c1*b1;
      stack1.Push(c1);
     }
    }
    i++;
   }

    Console.WriteLine(stack1.Pop());
    Console.ReadLine();
  }
 }
}
           
 **********************************************
 **                                                                            **
 **                    INTERFACE PROGRAM                         **
 **                                                                            **
 ***********************************************

using System;

namespace Multi
{
 
 interface ISO9001
 {
   bool desityck();
   bool oscillatoryck();
   bool visck();
 }
 interface ISO9002
 {
   bool denvis();
   bool heatvis();
   bool atrubutionck();
 }
 interface ISO2001
 {
   bool pre();
   bool visosci();
   bool denosci();
 }
 class product :ISO9002,ISO9001,ISO2001
 {
  public float density,vis,heatfactor,oscillatory,atrubution;
  public int one,two,three,id;
  public int on,tw,th;

  public  product(float a,float b,float c,float d,float e,int f)
  {
   this.density=a;
   this.vis=b;
   this.heatfactor=c;
   this.oscillatory=d;
   this.atrubution=e;
   this.one=0;
   this.two=0;
   this.three=0;
   this.id=f;
   this.on=0;
   this.tw=0;
   this.th=0;
  }
  public bool desityck()
  {
   if(this.density>10.0 && this.density<15.0)
   {
    this.on+=1;
    this.one++;
    return true ;
   }
   else
   {
    return false;
   }
  }
  public bool oscillatoryck()
  {
   if(this.oscillatory>100.0 && this.oscillatory<200.0)
   {
    this.on+=3;
    this.one++;
    return true ;
   }
   else
   {
    return false;
   }
  }
  public bool visck()
  {
   if(this.vis>1.0 && this.vis<5.0)
   {
    this.on+=7;
    this.one++;
    return true ;
   }
   else
   {
    return false;
   }
  }
  public bool denvis()
  {
   float temp;
   temp=this.density/this.vis*14-20;
   if(temp%2==0)
   {
    this.tw+=1;
    this.two++;
    return true ;
   }
   else
   {
    return false;
   }
  }
  public bool heatvis()
  {
   float temp;
   temp=this.heatfactor/this.vis*this.density;
   if(temp>5.0)
   {
    this.tw+=3;
    this.two++;
    return true ;
   }
   else
   {
    return false;
   }
  }
  public bool atrubutionck()
  {
   if(this.atrubution>15.0 && this.atrubution<21.0)
   {
    this.tw+=7;
    this.two++;
    return true ;
   }
   else
   {
    return false;
   }
  }
  public bool pre()
  {
   if(this.one==3.0 && this.two==3.0)
   {
    this.th+=1;
    this.three++;
    return true ;
   }
   else
   {
    return false;
   }
  }
  public bool visosci()
  {
   float temp;
   temp=this.heatfactor/this.vis/this.oscillatory;
   if(temp>0.5)
   {
    this.th+=3;
    this.three++;
    return true ;
   }
   else
   {
    return false;
   }
  }
  public bool denosci()
  {
   float temp;
   temp=this.density/this.oscillatory;
   if(temp>0.88)
   {
    this.th+=7;
    this.three++;
    return true ;
   }
   else
   {
    return false;
   }
  }
  public void status()
  {
   Console.WriteLine(“The id is  : {0}”,this.id);
   Console.WriteLine(“The Density is : {0}”,this.density);
   Console.WriteLine(“The HeatFactor is : {0}”,this.heatfactor);
   Console.WriteLine(“The Oscillatory Factor  is : {0}”,this.oscillatory);
   Console.WriteLine(“The Viscousity  is : {0}”,this.vis);
   Console.WriteLine(“The Atrubiton is : {0}”,this.atrubution);
   if(this.one>2)
   {
   Console.WriteLine(“The object with id {0} has  ISO9001Certification “,this.id);
   }
   if(this.three>2)
   {
    Console.WriteLine(“The object with id {0} has  ISO9002Certification “,this.id);
   }
   if(this.two>2)
   {
    Console.WriteLine(“The object with id {0} has  ISO2001Certification “,this.id);
   }
   

  }
 }

 class Class1
 {
  
  [STAThread]
  static void Main(string[] args)
  {
   
   int ch=0,ccount=0;
   float a,b,c,d,e;
   bool a1;
   product[] obj=new product[15];

   do
   {
    Console.WriteLine(“1.New Object \n2.Desity Check \n3.Oscillatory Check\n 4.Viscousity\n5.Desity Vis Ratio \n6.Heat Vis Ratio \n 7. Atri Check”);
    Console.WriteLine(“8.Stat \n9.Visc Oss Ratio\n10.Density Vis Ratio \n11.View Object status” );
    ch=int.Parse(Console.ReadLine());
    switch(ch)
    {
     case 1:

      Console.WriteLine(“Enter the Density value :”);
      a=float.Parse(Console.ReadLine());
      Console.WriteLine(“Enter the Viscousity value :”);
      b=float.Parse(Console.ReadLine());
      Console.WriteLine(“Enter the HeatFactor value :”);
      c=float.Parse(Console.ReadLine());
      Console.WriteLine(“Enter the Oscillatory value :”);
      d=float.Parse(Console.ReadLine());
      Console.WriteLine(“Enter the Atribution value :”);
      e=float.Parse(Console.ReadLine());
      obj[ccount]=new product(a,b,c,d,e,++ccount);
      
      break;
     case 2:
       a1=obj[ccount-1].desityck();
      if(a1==true)
      {
       Console.WriteLine(“Density check Passed “);
      }
      else
      {
       Console.WriteLine(“DensityCheck Failure”);
      }
      break;
     case 3:
      a1=obj[ccount-1].oscillatoryck();
      if(a1==true)
      {
       Console.WriteLine(“Oscillatory check Passed “);
      }
      else
      {
       Console.WriteLine(“Oscillatory check Failure”);
      }
      break;
     case 4:
      a1=obj[ccount-1].visck();
      if(a1)
      {
       Console.WriteLine(“Viscous check Passed “);
      }
      else
      {
       Console.WriteLine(“Viscous Check Failure”);
      }
      break;
     case 5:
      a1=obj[ccount-1].denvis();
      if(a1)
      {
       Console.WriteLine(“Density Visou Ratio check Passed “);
      }
      else
      {
       Console.WriteLine(“Density Visou Ratio  Check Failure”);
      }
      break;
     case 6:
      a1=obj[ccount-1].heatvis();
      if(a1)
      {
       Console.WriteLine(“Heat Vis Ratio check Passed “);
      }
      else
      {
       Console.WriteLine(“Heat Vis Ratio Check Failure”);
      }
      break;
     case 7:
      a1=obj[ccount-1].atrubutionck();
      if(a1)
      {
       Console.WriteLine(“Atribution check Passed “);
      }
      else
      {
       Console.WriteLine(“Atribution Check Failure”);
      }
      break;
     case 8:
      a1=obj[ccount-1].pre();
      if(a1)
      {
       Console.WriteLine(“ISO 9001 And ISO 9002  checks are  Passed “);
      }
      else
      {
       Console.WriteLine(“ISO 9001 And ISO 9002  checks are   Failure”);
      }
      break;
     case 9:
       a1=obj[ccount-1].visosci();
      if(a1)
      {
       Console.WriteLine(“Viscous and Osci Ratio  check Passed “);
      }
      else
      {
       Console.WriteLine(“Viscous and Osci Ratio Failure”);
      }
      break;
     case 10:
      a1=obj[ccount-1].denvis();
      if(a1)
      {
       Console.WriteLine(“Density Vis Ratio check Passed “);
      }
      else
      {
       Console.WriteLine(“Density Vis Ratio Check Failure”);
      }
      break;
     case 11:
      
      obj[ccount-1].status();
      break;
     
    }
      
   }while(ch>0 && ch<12);
  }
 }
}
USE IT !!!! FIX IT !!!!! PASS IT !!!

Open source is Future ………………… 

Advertisements

~ by dineshabe on September 3, 2006.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: