#include<iostream.h> #include<stdio.h> #include<conio.h> //------------------------------ item ---------------------------------// class item { private: char part_name[20]; float part_price; public: void get_data(); void show_data(); }; //------------------------------ sales --------------------------------// class sales { private: float sales_fig[3]; public: void get_data(); void show_data(); }; //--------------------------- hardware_item ---------------------------// class hardware_item:public item,public sales { private: char category[10]; char manufacturers[10]; public: void get_data(); void show_data(); }; //-------------------------- software_item ----------------------------// class software_item:public item,public sales { private: char category[10]; char operating_system[10]; public: void get_data(); void show_data(); }; //---------------------------- get_data( ) ----------------------------// void item::get_data() { cout<<\"\\t Enter part name = \"; gets(part_name); cout<<\"\\t Enter part price = \"; cin>>part_price; } //---------------------------- show_data( ) ---------------------------// void item::show_data() { cout<<\"\\t Part name = \"<<part_name<<endl; cout<<\"\\t Part price = \"<<part_price<<endl; } //---------------------------- get_data( ) ----------------------------// void sales::get_data() { cout<<\"\\n Enter the Sales figures for three months : \"<<endl; for(int count=0;count<3;count++) { cout<<\"\\t Sales for month \"<<count+1<<\" = \"; cin>>sales_fig[count]; } } //---------------------------- show_data( ) ---------------------------// void sales::show_data() { cout<<\"\\n Sales figures for three months : \"<<endl; for(int count=0;count<3;count++) cout<<\"\\t Sales for month \"<<count+1<<\" = \"<<sales_fig[count]<<endl; } //---------------------------- get_data( ) ----------------------------// void hardware_item::get_data() { item::get_data(); cout<<\"\\t Enter the category = \"; gets(category); cout<<\"\\t Enter the manufacturers = \"; gets(manufacturers); sales::get_data(); } //---------------------------- show_data( ) ---------------------------// void hardware_item::show_data() { item::show_data(); cout<<\"\\t Category = \"<<category<<endl; cout<<\"\\t Manufacturers = \"<<manufacturers<<endl; sales::show_data(); } //---------------------------- get_data( ) ----------------------------// void software_item::get_data() { item::get_data(); cout<<\"\\t Enter the category = \"; gets(category); cout<<\"\\t Enter the operating system = \"; gets(operating_system); sales::get_data(); } //---------------------------- show_data( ) ---------------------------// void software_item::show_data() { item::show_data(); cout<<\"\\t Category = \"<<category<<endl; cout<<\"\\t Operating system = \"<<operating_system<<endl; sales::show_data(); } main() { clrscr(); hardware_item h; software_item s; cout<<\"\\n ********* Hardware Item ********\"<<endl; h.get_data(); cout<<\"\\n ********* Software Item ********\"<<endl; s.get_data(); getch(); clrscr(); cout<<\"\\n ********* Hardware Item ********\"<<endl; h.show_data(); cout<<\"\\n ********* Software Item ********\"<<endl; s.show_data(); getch(); return 0; }