subject

Given main(), complete the Artist class (in files Artist. h and Artist. cpp) with constructors to initialize an artist's information, get member functions, and a PrintInfo( member function. The default constructor should initialize the artist's name to "None" and the years of birth and death to 0. PrintInfo() should display Artist Name, born if the year of death is -1 or Artist Name (-) otherwise. Complete the Artwork class (in files Artwork. h and Artwork. cpp) with constructors to initialize an artwork's information, get member functions, and a PrintInfo( member function. The constructor should by default initialize the title to "None", the year created to 0. Declare a private field of type Artist in the Artwork class. Ex. If the input is: Pablo Picasso 1881 1973 Three Musicians 1921 the output is: Artist: Pablo Picasso (1881-1973) Title: Three Musicians, 1921 If the input is: Brice Marden 1938 -1 Distant Muses 2000 the output is: Artist: Brice Marden, born 1938 Title: Distant Muses, 2000 File is marked as read only Current file: main. cpp 1 #include "Artist. h" 2 #include "Artwork. h" 3 #include 4 #include 5 using namespace std; 7 int main(int argc, const char* argv[]) { string userTitle, userArtistName; int yearCreated, userBirthYear, userDeathYear; getline(cin, userArtistName); cin >> userBirthYear; cin. ignore(); cin >> userDeathYear; cin. ignore(); getline(cin, userTitle); cin >> yearCreated; cin. ignore(); 20 Artist userArtist = Artist(userArtistName, userBirthYear, userDeathYear); Artwork newArtwork = Artwork(userTitle, yearCreated, userArtist); 23 24 newArtwork. PrintInfo(); 25 } Current file: Artist. h 1 #ifndef ARTISTH 2 #define ARTISTH 4 #include 5 using namespace std; 10 12 class Artist public: Artist(); Artist(string artistName, int birthYear, int deathYear); string GetName() const; int GetBirthYear() const; int GetDeathYear() const; void PrintInfo() const; private: // TODO: Declare private data members - artistName, birthYear, deathYear string artistName; int birthYear; int deathYear; }; 14 15 16 18 19 20 22 #endif Current file: Artist. cpp Load default template... 1 #include "Artist. h" 2 #include 3 #include 4 using namespace std; 6 Artist: :Artist() 15 16 artistName = "None"; birthYear = 0; deathYear = 0; 11 } 12 Artist:: Artist(string artistName, int birthYear, int deathYear) 13 { this->artistName = artistName; this->birthYear = birthYear; this->deathYear = deathYear; 17 } 18 string Artist::GetName() const 19 { 20 return artistName; 21 } int Artist::GetBirthYear() const 23 { 24 return birthYear; 25 } 26 int Artist::GetDeathYear() const 27 { return deathYear; 29 30 void Artist::printInfo() const 31 { cout << "Artist: " « artistName; if (deathYear != -1) cout << "1" << birthYear << "-" « deathYear << ")" << endl; else cout << ", born" << birthYear << endl; 37 } 32 33 34 35 36 Current file: Artwork. h - 1 #ifndef ARTWORKH #define ARTWORKH 4 #include "Artist. h" #include 6 using namespace std; class Artwork public: Artwork(); Artwork(string title, int yearCreated, Artist artist); string GetTitle(); int GetYearCreated(); void PrintInfo(); private: // TODO: Declare private data members - title, yearCreated // TODO: Declare private data member artist of type Artist string title; int yearCreated; Artist artist; 27 }; 28 29 #endif Current file: Artwork. cpp 1 #include "Artist. h" 3 // TODO: Define default constructor 4 // TODO: Define second constructor to initialize private fields (title, yearCreated, artist) 7 // TODO: Define get functions: GetTitle(), GetYearCreated() 9 // TODO: Define PrintInfo() function #include 11 #include 12 using namespace std; 13 Artwork:: Artwork 15 { title = "None"; yearCreated = 0; 14 Artwork::Artwork(string title, int yearCreated, Artist artist) 20 this->title = title; this->yearCreated = yearCreated; this->artist = artist; string Artwork::GetTitle) return title; 28 } int Artwork::GetYearCreated() 30 { 31 return yearCreated; 32 } void Artwork::printInfo() 34 { artist. printInfo(); 36 cout << "Title: " << title << ", " «< yearCreated << endl; 37 } 35

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:00
Write a function that draws a pool ball. this function should take as parameters, the color, the number that should go on the pool ball, and the location of the center of the pool ball. the radius of the pool balls should be pool_ball_radius, and the font of the number should be pool_ball_font. the text of the pool ball font should be white. drawpoolball(color.orange, 5, 100, 100); drawpoolball(color.green, 6, 50, 200); drawpoolball(color.red, 3, 150, 350); drawpoolball(color.blue, 2, 250, 140); to center the numbers on the pool ball, you should use the getwidth() and getheight() methods. you are allowed to call these methods on your text object, such as txt.
Answers: 3
question
Computers and Technology, 22.06.2019 11:10
Look at the far left lane in the picture. explain what the red car is doing and what it needs to do to travel safely.
Answers: 2
question
Computers and Technology, 23.06.2019 11:00
What are the possible consequences of computer hacking? what is computer piracy? describe some examples. what are the effects of computer piracy? what are the possible consequences of computer piracy? what is intentional virus setting? describe some examples. what are the effects of intentional virus setting? what are the possible consequences of intentional virus setting? what is invasion of privacy? describe some examples. what are the effects of invasion of privacy? what are the possible consequences of invasion of privacy? what is an acceptable use policy and what is the purpose of the acceptable use policy what is intellectual property and how can you use it?
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
George heard about the benefits of a data warehouse. he wants to try implementing one for his organization. however, he is afraid that transferring data to the data warehouse will affect transaction time. which element ensures that transactions are not affected when moving data to a warehouse? when data is transferred to a data warehouse, the a area frees the source system to continue transaction processing.
Answers: 2
You know the right answer?
Given main(), complete the Artist class (in files Artist. h and Artist. cpp) with constructors to in...
Questions
question
Mathematics, 25.01.2021 20:30
question
English, 25.01.2021 20:30
question
Spanish, 25.01.2021 20:30
question
Mathematics, 25.01.2021 20:30
question
Mathematics, 25.01.2021 20:30