BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan

BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan (http://bzupages.com/)
-   Object Oriented Programming (http://bzupages.com/35-object-oriented-programming/)
-   -   [Assignment] Solution Q no 1 ch#9 Object Oriented Programming in c++ by Robert Lafore (http://bzupages.com/f35/%5Bassignment%5D-solution-q-no-1-ch-9-object-oriented-programming-c-robert-lafore-1292/)

BSIT07-01 13-11-2008 01:09 AM

[Assignment] Solution Q no 1 ch#9 Object Oriented Programming in c++ by Robert Lafore
 
Just copied from book :)
Code:

#include
#include
using namespace std;

 
 
class publication         
  {
  private:
    string title;
    float price;
      public:
    void getdata()
    {
    cout << "\nEnter title: "; cin >> title;
    cout << "Enter price: "; cin >> price;
    }
    void putdata() const
    {
    cout << "\nTitle: " << title;
    cout << "\nPrice: " << price;
    }
      };
 
 
 
 
  class book : private publication     
      {
      private:
    int pages;
      public:
    void getdata()
    {
    publication::getdata();
    cout << "Enter number of pages: "; cin >> pages;
    }
    void putdata() const
    {
    publication::putdata();
    cout << "\nPages: " << pages;
    }
      };

 
 
 
 
  class tape : private publication     
      {
      private:
    float time;
      public:
    void getdata()
    {
    publication::getdata();
    cout << "Enter playing time: "; cin >> time;
    }
    void putdata() const
    {
    publication::putdata();
    cout << "\nPlaying time: " << time;
    }
      };
  ////////////////////////////////////////////////////////////////
  int main()
      {
      book book1;           
      tape tape1;
 
      book1.getdata();       
      tape1.getdata();
 
      book1.putdata();       
      tape1.putdata();
      cout << endl;
      return 0;
      }


talha111 15-03-2011 08:09 PM

Re: [Assignment] Solution Q no 1 ch#9 Object Oriented Programming in c++ by Robert Lafore
 
do u have the solution manual for robert lafore and deitel n deitel......


All times are GMT +5. The time now is 11:09 AM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.