Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions