Object Oriented Programming (CS304)
Assignment No.2
Deadline
Your assignment must be uploaded before or on Thursday 3rd of May, 2012
Rules for Marking
It should be clear that your assignment will not get any credit if:
o The assignment is submitted after due date.
o The assignment is copied.
o The assignment submitted in a format other than .cpp.
Objectives
The objectives of this assignment are,
o Giving the idea of practical implementation (prototype in C++) of basic object oriented concepts like abstraction, encapsulation, inheritance, association, aggregation and sub typing to students.
Assignment:
You are required to provide a practical prototype in c++ for the following class diagram. Mean you will have to provide the solution in the form of classes in c++.
Class Diagram for Assignment No. 2
Figure 1: Object Model of Song Library System
Also note that you don’t have to give actual implementation in c++ but simple stereotype (sketch) in the form of c++ code mentioning class names their parameters and functions with access specifiers.
You also have to show the relationship (inheritance, association, aggregation, composition) between classes in proper c++ syntax with comments.
Note: Every student will follow the above mentioned Object Model in order to develop solution of assignment No.2.
Example Object Model and its Prototype
#include<iostream.h>
#include<conio.h>
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 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
// ************************************************************
// ************************************************************
// ***********************************************************
Note: You are required to submit only .cpp file. Word document or any other file format will award you 0 marks.
CS304 Assignment No.2 help any one
Moderator: abdulsaboor
Re: CS304 Assignment No.2 help any one
Dear Admin
is there any solution????
is there any solution????
- abdulsaboor
- ADMIN
- Posts: 2004
- Joined: Fri Sep 28, 2007 3:42 am
- Location: vehari-punjab-pakistan
- Contact:
Re: CS304 Assignment No.2 help any one
#include<iostream.h>
#include<conio.h>
class user{
songslibrary * user;
public:
void playTrack();
void getName();
void getID();
private:
int ID;
char *name;
};
class administrator : public user
{
private:
Password;
public:
void getpassword();
void addtsongs();
void deletetrack();
void updatetrack();
void addsinger();
void updateartist();
void addalbum();
void deletealbum();
void updatealbum();
void addmusiccategory();
void deletemusiccategory();
void updatemusiccategory();
};
class musiccategory
{
musicitem musiccategory;
private:
void artist;
void band;
public:
void getalbum();
void gettrack();
void getsinger();
};
class folkmusic : public musiccategory
{
public:
void getband();
void getartist();
};
class filmmusic : public musiccategory
{
public:
void getband();
void getartist();
};
class popmusic : public musiccategory
{
public:
void getband();
void getartist();
};
class classicmusic : public musiccategory
{
public:
void getband();
void getartist();
};
class band
{
musiccategory * band;
private:
void banddeytails;
void bandname;
void artist;
public:
void getbanddeytails();
void getbandname();
void getartist();
};
class artist
{
musiccategory * artist;
band artist;
private:
void artistname;
void albums;
void tracks;
public:
void getartistname();
void getalbums();
void gettracks();
};
class track
{
artist track ;
album track;
public:
};
class album
{
artist album;
private:
public:
void gettrack();
void viewtrack();
void viewtracknumber();
void viewyear();
void getalbumid();
void gettitle();
};
class listner : public user
{
public:
void playtrack;
};
class songlibrarysystem{
musicitem *songlibrary;
private:
void user;
void musicitem;
public:
void getuser();
void getmusicitem();
};
#include<conio.h>
class user{
songslibrary * user;
public:
void playTrack();
void getName();
void getID();
private:
int ID;
char *name;
};
class administrator : public user
{
private:
Password;
public:
void getpassword();
void addtsongs();
void deletetrack();
void updatetrack();
void addsinger();
void updateartist();
void addalbum();
void deletealbum();
void updatealbum();
void addmusiccategory();
void deletemusiccategory();
void updatemusiccategory();
};
class musiccategory
{
musicitem musiccategory;
private:
void artist;
void band;
public:
void getalbum();
void gettrack();
void getsinger();
};
class folkmusic : public musiccategory
{
public:
void getband();
void getartist();
};
class filmmusic : public musiccategory
{
public:
void getband();
void getartist();
};
class popmusic : public musiccategory
{
public:
void getband();
void getartist();
};
class classicmusic : public musiccategory
{
public:
void getband();
void getartist();
};
class band
{
musiccategory * band;
private:
void banddeytails;
void bandname;
void artist;
public:
void getbanddeytails();
void getbandname();
void getartist();
};
class artist
{
musiccategory * artist;
band artist;
private:
void artistname;
void albums;
void tracks;
public:
void getartistname();
void getalbums();
void gettracks();
};
class track
{
artist track ;
album track;
public:
};
class album
{
artist album;
private:
public:
void gettrack();
void viewtrack();
void viewtracknumber();
void viewyear();
void getalbumid();
void gettitle();
};
class listner : public user
{
public:
void playtrack;
};
class songlibrarysystem{
musicitem *songlibrary;
private:
void user;
void musicitem;
public:
void getuser();
void getmusicitem();
};
DR ABDUL SABOOR
PHD Scholar at Superior University Lahore- Pakistan
MS Business Administration (HRM)
BS Business Administration (Marketing)
Member Editorial Board Science Publishing Group USA
Member Editorial Board International Journal of Marketing Studies
Cell=0308-6837987
Pakistan
PHD Scholar at Superior University Lahore- Pakistan
MS Business Administration (HRM)
BS Business Administration (Marketing)
Member Editorial Board Science Publishing Group USA
Member Editorial Board International Journal of Marketing Studies
Cell=0308-6837987
Pakistan