#include<iostream.h>
#include<conio.h>

class student{  //student class
    
    // student class attributes
    // Access specifier is by default private
    int ID;
    char * name;
    
    public:// public acccess specifier

    // student class functions/ operations    
    void login();
    bool Select();
    void read();
    }; // end of student class
    
// ********************************************************************
// ********************************************************************
// ********************************************************************    
    
    
class topic{ // topic class
    
    //topic class attributes
    // Access specifier is by default private
    int ID;        
    char * title;     

    public: // public access specifier

    // topic class functions/ operations    
    void add();
    void remove();
    bool select();
    void search();
    void View();
    void print();
    void download();
    };// end of topic class
    
// ********************************************************************
// ********************************************************************
// ********************************************************************   

    
class SubTopic: public topic {   // Inheritance relationship b/w topic and sub topic
     // Attributes of SubTopic class
     // Access specifier is by default private
     int SubID;
    
    };
    
// ********************************************************************
// ********************************************************************
// ********************************************************************   
    
class Lesson{ // Lesson class
    
    // Lesson class attributes
    // Access specifier is by default private  
    int ID;      
    topic * title;//aggregation relationship b/w lessons and topic   
    int NoOfLessons;
    
    public:// public access specifier

    // Lesson class functions/ operations    
    void add();
    void remove();
    bool select();
    void search();
    void View();
    void print();
    void download();
    };// end of Lesson class
// ********************************************************************
// ********************************************************************
// ********************************************************************   
      
    
class course{ //course class
   //Attributes of course class 
   char * code;       
   topic  title;    //composition relationship b/w Course and topic
   char * courseName;
   int duration;
   Lesson NoOfLessons;//composition relationship b/w Course and Lesson

    public:// public access specifier

    //course class functions/operations    
    void add();
    bool select();
    void View();
    void read();
    
    };// end of course class
    
// ********************************************************************
// ********************************************************************
// ********************************************************************   
  
class StudyProgram{ // StudyProgram class
    //Attributes of StudyProgram 
    // Access specifier is by default private
    char * Code;
    char * title;
    char * ProgramName;
    course duration; //composition relationship b/w StudyProgram and course
    
    public:// public access specifier
    bool select();
    char * ViewCourseList;
    };// end of StudyProgram class

// ********************************************************************
// ********************************************************************
// ********************************************************************   
  

class portal {// portal class
    //Attributes of portal class
    //Access specifier is by default private
    
    int NoOfStudyProgram;
    int selectedPrograms;
    int selectedCourse;
    
    StudyProgram * code;//aggregation relationship b/w portal and StudyProgram
    StudyProgram * title;//aggregation relationship b/w portal and StudyProgram
    
    public://public access specifier

    // portal class functions/ operations    
    void add();
    void remove();
    bool select();
    void search();
    void View();
    void print();
    void download();
    };// end of portal class
// ********************************************************************
// ********************************************************************
// ********************************************************************
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>

//Topic class
class topic{ 
    // Data members of Topic class
    int ID;  
    char  * Title;      
    char discription[200];
    
    //Public interface of topic class
    public: 
    //Default constructor
    topic(){    
    ID=1;
    Title=NULL;
     }
    //parametrized constructor
    topic(int id, char *title){
    ID=id;
    Title=new char[strlen(title)+1];
    strcpy(Title,title);
     }
     //setter function for ID
    void setId() {
    int id;
    cout<<"\nEnter ID: ";
    cin>>id;
      } 

        
    void setTitle() {
     char pChar[50];
     cout<<endl<<"\nEnter Title: ";
     cin.getline(pChar,50);
     Title=new char[strlen(pChar)+1];
     strcpy(Title,pChar);
       }    

    void setTitle(char * title){
        Title=title;
        }
        
    void setdiscription(){
        cout<<"\nplease enter discription of title"<<endl;
        cin.getline(discription,200);
        }


    int getId(){
     return ID;
     }
     
    char * getTitle(){
       return Title;
       }
        
    void add(){
        cout<<"\n*****************************************\n";
        cout<<"\nAdding new information in add method";
        setTitle();
        setdiscription();
        cout<<"\n*****************************************\n";  
        }
    
   bool select(){
        cout<<"Topic selection Area:"<<endl;
        int select;
        if (select==1)
        cout<<"\nTopic is selected"<<endl;
        else
        cout<<"\nTopic is not selected"<<endl;
        } 

    int search(){
        cout<<"In Search Mehtod:"<<endl;
       int found=0;
       if (found)
       		return 1;
   	   else
		return 0;
		}		

    void View() {
        cout<<"Viewing the Information";
        cout<<"\n*****************************************\n";
        cout<<"\nTitle is:"<< Title ;
        cout<<endl<<"\nDescription is:"<<discription[100];
        cout<<"\n*****************************************\n";
        }
            
    void print(){
        cout<<"\n*****************************************\n";
        cout<<endl<<"\nPrinting the Information:"<<endl;
        cout<<"Title:"<<Title<<endl<<"Discription:"<<discription;
        cout<<"\n*****************************************\n";  
          }
          
    void download(){
        cout<<"\n*****************************************\n";
        cout<<"\nDownloading the information:"<<endl;
        cout<<"Downloading under processing, Please wait:"<<endl;
        cout<<"You are downloding the following:"<<endl<<Title<<"file";
        cout<<" and the following discription"<<endl<<discription<<"File";
        cout<<"\n*****************************************\n";
        
        }
        
    void remove(){
        cout<<"\n*****************************************\n";
        cout<<"\nDeleting the information"<<endl;
        cout<<"\n*****************************************\n";
        delete []Title;
        delete [] discription;
         }
 
    ~topic(){
        
        }
    };
    

       
class SubTopic: public topic {   
     int SubID;
     char * title;
     char discription[100];

     public:
    
         void setSubID(){
             int subid;
             cout<<"Enter ID of Sub topic:";
             cin>>subid;
             }
                 
         void setdiscription(char []){
             char dChar[200];
             cout<<"Enter discription of Sub topic:"<<endl;
             cin.getline(dChar,200,'\n');
             }
             
         int getSubID(){
             return SubID;
             }
             
        void setTitle(){
             char pChar[50];
             char dChar[200];
             cout<<endl<<"Enter Title : ";
             cin.getline(pChar,50);
             cout<<endl<<"Enter Title discription:";
             cin.getline(dChar,200);
             if(strlen(dChar)>=90){
             cout<<"Eligible for being a topic"<<endl;
             }
             else
             {
             cout<<"Title just contains name and no description"<<endl;
             }
             }
        
         ~SubTopic(){
             
             
             }
    
    };


int main(){
    
    SubTopic sub;
    //sub.setId();
    sub.setTitle();
     
    sub.add();
    sub.View();
    sub.search();
    sub.select();
    sub.download();
    sub.print();
    sub.remove();

  system("pause");
  
}

these are he solution of my assigmnets 2 and three

In Assignment No.2 and 3 we added basic code in header and implementation files in the form of necessary attributes with suitable data types along with Constructor, Destructor and Getters/Setters for all data members and all other relevant functions belongs to “Topic” and “Sub topic” classes.

In this assignment we will finalize our coding by adding different relations among different classes (lesson, course, study program, topic and sub-topic), and writing main program for our complete sub-system.

Note: For two classes “Topic” and Sub-topic” you have already developed full code in last assignment. In this assignment, you just need to relate with other classes mentioned above that you can see and help from object model


please help me

mrnutty commented: i want my 15 seconds of my life back -3

Recommended Answers

All 2 Replies

How do you want to relate all the classes ? and what is the question to these assignments ?

use CODE tags

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.