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

Store first n natural no in a file - c program, Program is to store first n...

Program is to store first n natural no in a file: Write a program to  store first n natural no in a file void main()     {     fstream file;     file.open("studen

Mini Search Engine, How do I create two functions: one to put a collection ...

How do I create two functions: one to put a collection of criteria into normal form, and one to compute the score of a document. A collection of criteria will be represented using

Minimumshelf, Write a program that finds the minimum total number of shelve...

Write a program that finds the minimum total number of shelves, including the initial one required for this loading process.

Arrays and pointers, i have an array of structs, and am trying to make a po...

i have an array of structs, and am trying to make a pointer that can point to a certain struct within the array

Change to palindrome, A palindrome is a string that reads the same from bot...

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Hw8, Asks the user for an integer. if the number is less than 21, ask them ...

Asks the user for an integer. if the number is less than 21, ask them for a number again; repeat this until you get a number bigger than 20. 20 is not an acceptable number. Once yo

Define the float data type of c language, Define the Float Data Type of c L...

Define the Float Data Type of c Language? The float is used to define floating point numbers. The Floating point numbers are stored in 32 bits with 6 digits of precision. Eg

#padovan string in c , #padovan string in java   program in java /...

#padovan string in java   program in java // aakash , suraj , prem sasi kumar kamaraj college program 1 : package test.padovanstring; public class PadovanStrin

Minimum shelf, At a shop of marbles, packs of marbles are prepared. Packets...

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

Explain the defination and declaration of union, Explain the Defination and...

Explain the Defination and Declaration of Union? Generally in terms the composition of a union may be defined as be as union tag { member 1; member 2; member m; }; Wh

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