CS304 Assignment No. 3 Spring 2012 solution

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

  • User
  • Listener
  • Administrator

 

Now for implementing these three classes practically in c++ you have to define classes according to the requirements 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

Implement different type of relations between these classes


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

}

 

Solution

/* CRRETE LISTENER CLASS ON YOUR OWN
AND MAKE CHANGES ACCORDING TO THE REQUIRMENT*/

#include
#include
using namespace std;

//Topic class
class user{
// Data members of Topic class
int ID;
char * Naam;

//Public interface of topic class
public:
//Default constructor
user(){
ID=1;
Naam=NULL;
}
//parametrized constructor
user(int id, char *naam){
ID=id;
Naam=new char[strlen(naam)+1];
strcpy(Naam,naam);
}
//setter function for ID
void setId() {
int id;
cout<<"nEnter ID: "; cin>>id;
}

void setNaam() {
char pChar[50];
cout<>pass;
}

void trackadd()
{
cout<<"nadd trackn"; } void trackdel() { cout<<"delete track"< DOWNLOAD SOLUTION HERE

loading...