If You Are From The 09 Batch Then Read This >>

This Site is created for the Bharati Vidyapeeth's BCA 09 Batch..and hence everyone from you are requested to send your email ID at abhilash238650@gmail.com..Owner will send you a request to your Email-ID and after accepting it even you can post your views, day to day experiences and class works on this blog.
Visit owner's blog at
www.bloggerabhilash.info

Wednesday, December 22, 2010

Program 21 to 24 !!!



21.write a programe for operator == for string

#include
#include
Class Prashant
{
char name[20];
int flag;
void getdata()
{
cout<<"Enter the Name";
cin>>name;
}
int operator==(prashant s)
{
flag=stremp(name,s.name);
return flag;
}
};
void main()
{
clrscr()
prashant s.t;
s.getdata();
t.getdata();
int x=(t==s);
y=(x==0)
cout<<"String are Equal";
else
cout<<"Not Equal";
getch();
}


22.Write a programe to demonstrate multiple hierasehical inheretense
a.accept deposit
b.display balance
c.compute & deposite interupt
4.permit withdrawl and update balance




#include
#include

Class account
{
public:
       char name[25];
       char type of[25];
       int amt,bal,withdraw,deposit;
     
account()
{
bal=500;
}
void getdata()
{
cout<<"Enter the name,a/c number and the type of ";
cin>>name>>accno>>typeof;
}
};
class current:public account
{
public:
void getdeposit()
{
cout<<"Enter the Deposit amt\n";
cin>>deposit;
bal=bal+deposit;
}
void withdrawamt()
{
cout<<"Enter the amt to withdraw\n";
cin>>withdraw;
}
void penalty()
}
if(bal<500)
bal=bal-50;
}
void display()
{
cout<<"Name\t"<<<<\n Accounttype\t",,typeof<<"\nBalance"<
}
};
class using:public account
{
float interest;
public;
void getdeposit()
{
cout<<"\nEnter the deposit amount\n";
cin>>deposit;
bal=bal+deposit;
}
void cal instrest()
{
int n=3;float r=7.5;
intrest=(bal*n*r)/100;
bal=bal+intrest;
}
void withdraw amt()
{
cout<<"Enter the amt to withdraw \n";
cin>>withdraw:
bal=bal-withdraw;
}
void penelty()
{
if(bal<500)
bal=bal-50;
}
void display()
{
cout<<"Name \t"<<<"\n Account \t"<<<"\naccount type\t"type of <<"\n balance "<<<
}
};
void main()
{
clrscr();
current a;
a.getdata();
a.getdeposit();
a.withdrawamt();
a.penalty();
a.display();

savingb;
b.getdeposit();
b.calintrest();
b.withdrawamt();
b.penalty();
getch();
}


23.write a program to demonstrate hybride inheramtence

#include
#include

Class student
{
public:
       char name[25];
int rollno;
void getdata()
{
cout<<"Enter the name & roll no of the student";
cin>>name>>rollno;
}
};
class test:public student
{
public:
int sem1,sem2;
void getmarks()
{
cout<<"\n Enter the marks of sem1 and sem2 \n";
cin>>sem1>>sem2;
}
};
class sports
{
public:
      int sportmarks;
voidgetscore()
{
cout<<"\n Enter the marks of sports \n;
cin>>sportsmarks;
}
};
class result:public  test.public sports
{
public:
int total;
void caltotal()
{
total=sem1+sem2+sportsmark;
}
void display()
{
cout<<"\n name1+"<<<"\nRoll no+"<<<"\ntotalmarks+"<
}
};
void main()
{
char();
resilts;
s.getdata();
s.getmarks();
s.getscore();
s.caltotal();
s.display();
getch();
}


24) WAP 2 model a database wth emp as a base class & wth the att name, id , for mgr att are titles & dues, writer attributes book labour att are wages.

    #include
    #include
   class employee
   {
   public:
   long id;
   char name[25];
   void get data()
   {
   cout<<"n\enter the name & id\n";
   cin>>name>>id;
    }
  };
   class manager:public employee
   {
   public :
   char title[30];
   long due;
   void get info ()
   {
   cout<<"\n enter the title & dues amt\n";
   cin>>title>>dues;
   }
   void display()
   {
   cout<<"\n Name\t"<<<"nid\t"<<<"\n
  title \t"<<<"\n dues\t"<
  }
};
class writer:public employee
{
public:
char books [25];
void get books()
{
cout <<"\nenter the name of  books\n";
cin>> books;
}
void display()
{
cout <<"\n Name \t"<<<"\nid\t"
<<<"\n book\t"<
  }
};
class labour :public employee
{
public:
int wages;
void get wages()
{
cout <<"enter the wages of the employee\n";
cin>>wages;
}
void display()
{
cout <<"enter the wages of the employee\n";
cin>>wages;
}
void display()
}
cout <<"\n Name \t"<<<"\nid\t"
<<<"\nwages\t"<
  }
};
void main()
{
clrscr();
manager s;
s.getdata();
s.getinfo();
s.display();
writer a;
a.getdata();
a.getbooks();
a.getdisplay();
labour b;
b.getdata();
b.getwages();
b.display();
getch();
}

No comments:

Post a Comment

You can ask your queries here and we will try to get back to you as soon as we will be done working with that..

Note: Only a member of this blog may post a comment.

Just Type The Keyword To Search Your Answer -- >>