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, 21.06.2019 20:20
Sometimes writers elaborate on the truth when recalling past events so they can enhance their narrative essay with more interesting descriptions. do you feel that published writers should or should not embellish real life events just to make their stories more interesting?
Answers: 2
question
Computers and Technology, 23.06.2019 01:30
1. which of the following is a search engine? a) mozilla firefox b)internet explorer c)google d)safari 2. which of the following statements is true? a) all search engines will provide the same results when you enter the same query. b) all search engines use the same amount of advertisements. c) some search engines are also browsers. d) search engines often provide different results, even when you enter the same query.
Answers: 2
question
Computers and Technology, 23.06.2019 17:00
1. which of the following is not an example of an objective question? a. multiple choice. b. essay. c. true/false. d. matching 2. why is it important to recognize the key word in the essay question? a. it will provide the answer to the essay. b. it will show you a friend's answer. c. it will provide you time to look for the answer. d. it will guide you on which kind of answer is required.
Answers: 1
question
Computers and Technology, 23.06.2019 21:30
Write a fragment of code that reads in strings from standard input, until end-of-file and prints to standard output the largest value. you may assume there is at least one value. (cascading/streaming logic, basic string processing)
Answers: 3
You know the right answer?
Given main(), complete the Artist class (in files Artist. h and Artist. cpp) with constructors to in...
Questions
question
Chemistry, 18.10.2021 21:30
question
History, 18.10.2021 21:30
Questions on the website: 13722362