Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

Object Oriented Programming (CS304)

Assignment No.04

 

Total Marks                                                                                                             20

 

Deadline

 

Your assignment must be uploaded before or on 26th May, 2012.

Rules for Making

 

It should be clear that your assignment will not get any credit if:

 

  • The assignment is submitted after due date
  • The assignment is copied

 

Objectives

 

This assignment has been designed so that you would be able to implement the concept of Inheritance in OOP. After the completion of this assignment you should have a good grasp on how to implement.

 

  • Inheritance
  • Aggregation and Composition
  • Using basic constructs of OOP in a program

 

In previous assignments we have understood all the basics of the Song Library System including the Object Model Diagram and highlighted the Abstraction of classes in terms of attributes and functions prototype. Now it is time to implement the full system in parts, so this assignment is first step towards it.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Assignment:

Object Model for 4th assignment:

 

 

In this assignment you have to code/implement the below said classes in running form these classes are,

 

  • Music Items
  • Music Category
  • Band
  • Artist
  • Album
  • Track
  • Folk Music
  • Classic Music
  • Film Music
  • POP Music

 

 

Now for implementing these three classes practically in c++ you have to define classes according to the requirements (solution of second assignment) given below:

 

  1. Implement data members and member functions for each class
  2. Implement constructor and destructor for each class
  3. Implement setters and getters functions for each class
  4. Implement different type of relations between these classes

 

Sample Example:

 

//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];

     coutendl"\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 ;

        coutendl"\nDescription is:"discription[100];

        cout"\n*****************************************\n";

        }

           

    void print(){

        cout"\n*****************************************\n";

        coutendl"\nPrinting the Information:"endl;

        cout"Title:"Titleendl"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:"endlTitle"file";

        cout" and the following discription"endldiscription"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];

             coutendl"Enter Title : ";

             cin.getline(pChar,50);

             coutendl"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(){

            

            

             }

   

    };

 

Uploading Instructions:

Complete this assignment using single .cpp file. You have to upload your running .cpp file with no dependency to external .h or .cpp file other then built in header files like iostream etc (If not followed will be awarded zero marks).

 

Views: 7974

Attachments:

Replies to This Discussion

Solution is developed now, I will uploaded with in few seconds, count down start now...!!!

AAAnnnnnnn Do Bhai

solution kaha ha cs304 ka

tahir Ramzan bahi kb solutn uplload krain gy mujhe lagta hai k ap pagal bna rhe hai sb ko

#include <iostream.h>
#include <string.h>  
#include <stdlib.h>  
using namespace std;
class MusicCategory //MusicCategory class prototype which have composition relationship with Music Items Also have four child classes as well along with aggregation relation with Band and Artist
{
private:
        Artist *artist;
        Band *band;

public:
       MusicCategory();//default constructor
       {
                                 cout"musicCategory default constructor is called"endl;
       }
        void getAlbum();
        void getTrack();
        void getArtist();
        ~MusicCategory(); //default destructor     
};

class Folk_Music:public MusicCategory    // Folk_Music class prototype which is inherited from  MusicCategory
{

public:
        Folk_Music(); //default constructor
        void  getBand();
        void getArtist();
        ~Folk_Music();  //default destructor 
};

class Film_Music:public MusicCategory  //Film_Music class prototype which is inherited from  MusicCategory
{
public:
        Film_Music();//default constructor
        void getBand();
        void getArtist();
        ~Film_Music();//default destructor
};
class POP_Music:public MusicCategory  //POP_Music class prototype which is inherited from  MusicCategory
{

public:
      
        POP_Music();//default constructor
       void getBand();
        void getArtist();
       ~POP_Music();//default destructor 
};

class Classic_Music: public MusicCategory  //Classic_Music class prototype which is inherited from  MusicCategory
{
public:
       Classic_Music();//default constructor
        void getBand();
        void getArtist();
         ~ Classic_Music();//default destructor
};
class Artist //Artist class prototype which have aggregation relation with Music Category

{
private:
        string ArtistName;
        Album Albums;
        Track Tracks;

public:    
        Artist();//default constructor
        void getTrack();
        void getAlbum();
        void getArtistName();
        void getMusicCategory();
        ~Artist();//default destructor
};
class Band //Band class prototype which have aggregation relation with Music Category and composition relationship with Artist

{
private:
        Artist art;
        string BandName;
        string BandDetails;
             
public:
        Band();//default constructor
        void getArtist();
        void getBandDetails();
        void getBandName();
        ~Band();//default destructor
 
};
class Album  //Album class prototype which have composition relation with Artist
{
private:
        int AlnumID;
        string AlbumTitle;
        int TrackNumber;
        int Year;
        Track track;
 
public:
        Album();
        void getTrack();
        void vewTrack();
        void vewTracknumber();
        void viewYear();
        void getAlbumID();
        void getTitle();
    ~ Album();//default destructor
};
  class Track  //Track class prototype which have composition relation with Artist and Album
{
private:
        string TrackName;
        int TrackId;
        string Lyrics;
      
public:
        Track();//default constructor        
        void playTrack();
        void stopTrack();
        void pauseTrack();
        void downloadTrack();
        void getTrackName();
        void getTrackID();
        void getLyrics();
        ~Track();//default destructor
};

class MusicItems  //MusicItems class prototype which have aggregation relationship with Song Library System 
  {
private: 
         MusicCategory musiccategory;
               
public:
        MusicItems();
        void getMusicCategory();
        void getAlbum();
        void getArtist();
        void getTrack();
        void getBand();
        ~  MusicItems();//default destructor
};

main ()
{
cout"Sir i wrote as i understand"endl;

system("PAUSE");

}

thnx sooooooooo much amna khan...

but Farri its not complet solution...

Amina khan phir sale nhe hui assignment

shukar kro send kr di ahi Amina ne ap un ko agy se charha rhy hain uff koi hal ni bhalai ka zmana ni raha

thanksssssssss bara saaaaaaa sis thanksssssss so much :) hamary ye hidden hand ap k liye special dua k liye uthain gay

Tahir Ramzan Dear Upload Assign Plzzzzzzzzzzzzzzz

Tahir bhai 10 bajay light chali jaye gi

jaldi kro plz

yh wala solution tu 100% galat hai, subh zahoor nay upload kea tha yh wala,,,,,,,,!!!!!

RSS

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service