#include<iostream>
using namespace std;

class Item
{
protected:

string Title;
float price;
public :
void getItem()

{
cout<<"Please Enter product Title : ";
cin>>Title;
cout<<"Please Enter Price : ";
cin>> price;
}
void displayItem()
{
cout<<"\nTitle and price : " <<Title  <<"\t" <<price;
}
};
class Sales
{
protected :
float sale_per_item[3];
public : 
void getSales()
{
cout<<"Enter Sale Figures for Three monthes <press Enter After Each entery > : ";
for(int i=0; i<3; i++)
{
cin>>sale_per_item[i];
}
}
void displaySales()
{
cout<<"\nThese are sales figures for last three monthes: \t";
for(int i=0; i<3; i++) 
{
cout<< sale_per_item[i]<<"\t";
}
cout<<"\n\n*************************\n\n";
}

};
class hardItem : Item , Sales
{
private :
string category;
string O_Manufacturer;
public :
void gethardItem()
{
getItem();
cout<< "Please Enter Caqtegory : ";
cin>> category;
cout<<"Please Enter manufacturer : ";
cin >>O_Manufacturer;
getSales();
}
void displayhardItem()
{
displayItem();
cout<<"\nCategory and Manfucaturer:"<<category << "\t" <<O_Manufacturer ;
displaySales();
}
};
class softItem :Item , Sales
{
private :
string category ;
string OS;
public :
void getsoftItem()
{
getItem();
cout<<"Please Enter category : ";
cin >> category;
cout<<"Please enter Operating System : ";
cin >>OS;
getSales();

}
void displaysoftItem()
{
displayItem();
cout<<"\nCategory and Operating System :  "<< category << "\t" <<OS ;
displaySales();
}
};
main()
{
softItem soft1;
hardItem hwd1;
hwd1.gethardItem();
hwd1.displayhardItem();
soft1.getsoftItem();
soft1.displaysoftItem();
}

Post a Comment

Don't Forget To Join My FB Group VU Vicky
THANK YOU :)

Previous Post Next Post