Untitled
unknown
plain_text
2 years ago
4.9 kB
31
Indexable
#include <iostream> #include <stdlib.h> using namespace std; class Amity_University { public: void show() { cout << "***************************Welcome to Amity University Jharkhand****************************** " << endl; } }; class B_Tech : public Amity_University { public: void btech() { cout << "***********************Welcome to B.Tech section******************************" << endl; } }; class IT : public Amity_University { public: void it() { cout << "***********************Welcome to BCA section******************************" << endl; } }; class MBA : public Amity_University { public: void mba() { cout << "***********************Welcome to MBA section******************************" << endl; } }; class B_COM : public Amity_University { public: void bcom() { cout << "***********************Welcome to B.COM section******************************" << endl; } }; class BJMC : public Amity_University { public: void bjmc() { cout << "***********************Welcome to BJMC section******************************" << endl; cout << "The number of seats in BJMC = " << 100 << endl; } }; class CSE : public B_Tech { public: void showcse() { btech(); cout << "The number of seats in computer science branch (CSE) = " << 150 << endl; } }; class ECE : public B_Tech { public: void showece() { btech(); cout << "The number of seats in Electrical science branch = " << 50 << endl; } }; class MEC : public B_Tech { public: void showmec() { btech(); cout << "The number of seats in Mechanical branch = " << 50 << endl; } }; class CE : public B_Tech { public: void showce() { btech(); cout << "The number of seats in Civil branch = " << 50 << endl; } }; class BCA : public IT { public: void showbca() { it(); cout << "The number of seats in BCA = " << 100 << endl; } }; class MCA : public IT { public: void showmca() { it(); cout << "The number of seats in MCA = " << 100 << endl; } }; class BBA : public MBA { public: void showbba() { mba(); cout << "The number of seats in BBA = " << 200 << endl; } }; class M_COM : public B_COM { public: void showmcom() { bcom(); cout << "The number of seats in M.COM = " << 200 << endl; } }; int main() { int choice; B_Tech btech; while (1) { cout << "Enter 1 for BTech course" << endl; cout << "Enter 2 for IT course" << endl; cout << "Enter 3 for MBA course" << endl; cout << "Enter 4 for BCOM course" << endl; cout << "Enter 5 for BJMC course" << endl; cout << "Enter 0 for Exit" << endl; cout << "Enter Your choice" << endl; cin >> choice; if (choice == 0) { exit(0); } else { switch (choice) { case 1: int ch; cout << "Enter 1 for computer science branch (CSE)" << endl; cout << "Enter 2 for Electrical branch (ECE)" << endl; cout << "Enter 3 for Mechanical branch (MEC)" << endl; cout << "Enter 4 for Civil branch (CE)" << endl; cout << "Enter the branch in BTECH" << endl; cin >> ch; if (ch == 1) { CSE c; c.showcse(); break; } else if (ch == 2) { ECE e; e.showece(); } else if (ch == 3) { MEC m; m.showmec(); } else { CE ce; ce.showce(); } break; case 2: int ch2; cout << "Enter 1 for BCA branch " << endl; cout << "Enter 2 for MCA branch " << endl; cin >> ch; if (ch2 == 1) { BCA bca; bca.showbca(); } else { MCA mca; mca.showmca(); } break; case 3: BBA bba; bba.showbba(); break; case 4: M_COM mcom; mcom.showmcom(); break; case 5: BJMC bj; bj.bjmc(); break; default: cout << "Please Enter the valid choice" << endl; exit(0); } } } }
Editor is loading...