You are on page 1of 5

CS304P-Object Oriented Total marks = 20

Programming Practical Deadline


th
Assignment Solution # 02 26 of Jan 2023
FALL 2022

Please carefully read the following instructions before attempting the assignment
Solution.

NOTE
Don't copy-paste the same answer.
Make sure you can make some changes to your solution file before submitting
copy paste solution will be marked zero.
If you found any mistake then correct yourself and inform me.
Before submitting an assignment/GDB check your assignment requirement file.

For any query, feel free to Contact at Whatsapp:


+923074960034

Provide by M.JUNAID QAZI

Student id: ……………….


Code:
#include <iostream>
using namespace std;

class Artist {
protected:
string name;
string band;
string category;
string instrument;
public:

CONTACT ON WHATSAPP
+923074960034
void setArtist(string n, string b, string c, string i) {
name = n;
band = b;
category = c;
instrument = i;
}
void printArtist() {

cout << "Artist name: " << name << endl;


cout << "Music Band name: " << band << endl;
cout << "Music Category name: " << category << endl;
cout << "instrument name: " << instrument << endl<< endl;
}
};

class Pop : public Artist {


public:
void setPop(string firstName, string bandName, string c, string i) {
setArtist(firstName, bandName, c, i);
}
void printPop() {
printArtist();
}
};

class Classic : public Artist {


public:
void setClassic(string firstName, string bandName, string c, string i) {
setArtist(bandName, firstName, c, i);
}
void printClassic() {
printArtist();
}
};

int main() {
CONTACT ON WHATSAPP
+923074960034
// Create an instance of the Pop class and a Classic class
Pop pop;
Classic classic;
// Get input from the user for the Pop artist
string firstName, bandName, category, instrument;
cout<<" Solution By M.junaid Qazi
"<<endl;
cout << " TO Get Solution Contact On +923074960034
"<<endl;
cout<<"--------------------------------------------------------------------------------------------
--------------------------"<<endl;

cout << "VUID: BCxxxxxxxxx " << endl << endl<< endl;
cout << "Enter Artist name: ";
cin >> firstName;
cout << "Enter Music Band name: ";
cin >> bandName;
cout << "Enter Music Category name: ";
cin >> category;
cout << "Enter instrument name: ";
cin >> instrument;
cout<<endl;
pop.setPop(firstName, bandName, category, instrument);

// Get input from the user for the Classic artist


cout << "Enter Artist name: ";
cin >> firstName;
cout << "Enter Music Band name: ";
cin >> bandName;
cout << "Enter Music Category name: ";
cin >> category;
cout << "Enter instrument name: ";
cin >> instrument;
cout<<endl;
classic.setClassic(firstName, bandName, category, instrument);

CONTACT ON WHATSAPP
+923074960034
// Display the information for the Pop artist
cout << "Data of First Artist:" << endl << endl;
pop.printPop();
cout << endl;
// Display the information for the Classic artist
cout << "Data of Second Artist:" << endl << endl;
classic.printClassic();

return 0;
}

CONTACT ON WHATSAPP
+923074960034
Every assignment/GDB is change due to unique Student ID so Don’t
Copy That is truly perfect step by step idea solution get help easily.

M.juniad Qazi
WHATSAPP +923074960034

CONTACT ON WHATSAPP
+923074960034

You might also like