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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 22:30, raiapowell
I'll mark brainliest if answered right! with which feature or menu option of a word processing program can you make an image like this? you can get this image using the option of a word processing program.
Answers: 1
image
Computers and Technology, 23.06.2019 18:50, annieleblanc2004
Ais a picture icon that is a direct link to a file or folder
Answers: 1
image
Computers and Technology, 25.06.2019 03:00, samanthaurso1
Between 1932 and 1938, chester carlson developed a process that enabled a "picture" of a document to be taken and then have it reproduced on another
Answers: 1
image
Computers and Technology, 25.06.2019 15:30, csarge2972
How can improving one’s reasoning skills also improve one’s performance on the job?
Answers: 1
You know the right answer?
Given main(), complete the Artist class (in files Artist. h and Artist. cpp) with constructors to in...

Questions in other subjects:

Konu
Mathematics, 10.05.2021 19:00
Konu
Chemistry, 10.05.2021 19:00
Konu
English, 10.05.2021 19:00