Could you help me solve the qusetion? USing C++. Thanks! Create a class (named:
ID: 3702325 • Letter: C
Question
Could you help me solve the qusetion? USing C++. Thanks!
Create a class (named: Painting) with a default constructor, a constructor with parameters for each data member, and the following private data members: Question 10 Not answered Mark 0.00 out of 5.00 value, which is a floating point value (initialize to 0 in the default constructor). title, which is a string (initialize to empty string in the defauit constructor) artist, which is a string (initialize to empty string in the default constructor) Your second constructor should take all data member variables as input in the order they are specified above. You only need to write the class definition and any code that is required for that class. Place all code within the class definition Answer: (penalty regime 0%) P Flag questionExplanation / Answer
#include<iostream>
using namespace std;
class Painting
{
float value;
string title;
string artist;
public:
// default constructor
Painting()
{
this->value = 0.0;
this->title = "";
this->artist = "";
}
// constructor
Painting(int value, string title, string artist)
{
this->value = value;
this->title = title;
this->artist = artist;
}
// getter methods
int getValue()
{
return this->value;
}
string getTitle()
{
return this->title;
}
string getArtist()
{
return this->artist;
}
};