Program is to define a class as teacher, C/C++ Programming

Assignment Help:

Program is to define a class as teacher:

Program is to define a class as teacher and collect information about them by using classes and object

class teacher

  {

  private:

    char name[20];

    char sub[10];

    float basic,hra,da;

    float salary;

    int calculate()

     {

     salary=basic+hra+da;

      return salary;

     }

  public:

     void readdata();

     void dispdata();

  };

 

void teacher::readdata()

  {

  clrscr();

  cout<<" enter your name "<<"\n";

  gets(name);

  cout<<" enter the subject you teach "<<"\n";

  cin>>sub;

  cout<<" enter the basic salary "<<"\n";

  cin>>basic;

  cout<<" enter the house rent allowance "<<"\n";

  cin>>hra;

  cout<<" enter the dearance allowance"<<"\n";

  cin>>da;

   }

 

void teacher::dispdata()

  {

  clrscr();

  cout<<" the name is :"<

  cout<<" the subject you teach is :"<

  calculate();

  cout<<" the salary you get is : "<

  }

 

 void main()

  {

  clrscr();

  teacher info;

  info.readdata();

  info.dispdata();

  }


Related Discussions:- Program is to define a class as teacher

Develop a c program for linux, develop a C program for Linux called pipes.c...

develop a C program for Linux called pipes.c that does the following: In the main() function, it creates a pipe using the pipe() function, then creates two child processes with

Charity Ball Organizer, Charity Ball Organizer Many charities support g...

Charity Ball Organizer Many charities support good causes, but one of the difficulties each of them has is organizing their fundraising events. After nearly a semester of C pro

Define meaning of call by reference - computer programming, Define the Mean...

Define the Meaning of Call by reference? In "call-by- reference", as an alternative of passing the value of a variable, the location number (or the address) of the variable is

#otto cycle, To get the efficiency of Otto cycle by C/C++.

To get the efficiency of Otto cycle by C/C++.

Introduction to c programming, How would you print the values of the variab...

How would you print the values of the variables words and lines so they appear in the form: There were 6040 words and 680 lines. Here, 6040 and 680 represent the values of the two

Input, I want to take 1.1 as input but when I am declaring it as float the ...

I want to take 1.1 as input but when I am declaring it as float the output is given as 1.1000000

Algorithm, Write algorithms to implement the insertion and deletion operati...

Write algorithms to implement the insertion and deletion operations.

Explain pure virtual functions, Pure Virtual Functions An abstract clas...

Pure Virtual Functions An abstract class is one, which is used just for deriving some other classes. No object of this class is declared and used in the program. Likewise, ther

Big M method, I Want a answer for solving the big M method in the topic of ...

I Want a answer for solving the big M method in the topic of simplex method...

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd