Computers and Technology

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

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 08:00, jcastronakaya
Apex q: what does a low employment rate indicate? a. not many people are earning high salaries b. not many people are going to college c. not many people are renting their homes d. not many people have jobs
Answers: 2
image
Computers and Technology, 23.06.2019 16:30, isaiahhuettnerowgg8d
What is one reason why indoor air pollution has become an increasing problem.
Answers: 1
image
Computers and Technology, 24.06.2019 14:00, Abrahamolve
When creating a field in a table, you must set the to determine what type of data the field can store. field property data type field type data property
Answers: 1
image
Computers and Technology, 24.06.2019 20:30, LaughingAlanna
Does the query hawaiian photographers fully meets results?
Answers: 1
Do you know the correct answer?
Given main(), complete the Artist class (in files Artist. h and Artist. cpp) with constructors to in...

Questions in other subjects: