Question: Assistance in cleaning out this code with instructions below : #include using namespace std; class painting { protected: string title; string author; int value; public:

Assistance in cleaning out this code with instructions below :

#include

using namespace std;

class painting {

protected:

string title;

string author;

int value;

public:

painting(string title = "", string authour = "", int value = 400);

void display();

};

painting::painting(string title, string author, int value)

{

title = Title;

author = Author;

value = Value;

}

void painting::display()

{

cout << Title << ;

cout << Author << ;

cout << value << ;

}

class FamounsPainting :public painting {

public:

FamounsPainting(string title, string author, int value = 25000);

painting(title, author, value) {}

};

int main()

{

painting*paintings = new painting[N];

string famous[M] =

{ "Degas","Monet","Picasso","Rembrandt" };

string title, author;

int i, k, j;

cout << " Enter title of painting :";

getline(cin, title);

cout << "Enter author of paintings:";

getline(cin, author);

k = -1

{

if (famous[j] == author)

{

k = j;

break;

}

}

if (k != -1)

paintings[i] = FamounsPainting(title, author);

else

paintings[i] = painting(title, author);

}

{

system("pause")

return 0;

}

Create a Painting class that holds the painting title, artist name, and value. All Paintings are valued at $400 unless they are FamousPaintings. Include a display function that displays all fields. The FamousPainting subclass overrides the Painting value and sets each Paintings value to $25,000. Write a main()function that declares an array of 10 Painting objects. Prompt the user to enter the title and artist for each of the 10 Paintings. Consider the Painting to be a FamousPainting if the artist is one of the following: Degas, Monet, Picasso, or Rembrandt. Display the 10 Paintings. Save the file as Paintings.cpp.

Note: instead of displaying the 10 paintings to the console as requested by the exercise, output the 10 paintings to a file named Paintings.txt. Each data field output should be separated by a space.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!