Please
Please use C++ to complete Artist.h, Artist.cpp, Artwork.h, and Artwork.cpp files. Main.cpp cannot be changed.
Artist.h Given:
#ifndef ARTISTH
#define ARTISTH
#include <string>
using namespace std;
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
};
#endif
Artist.cpp Given:
#include "Artist.h"
#include <iostream>
#include <string>
using namespace std;
// TODO: Define default constructor
// TODO: Define second constructor to initialize
// private fields (artistName, birthYear, deathYear)
// TODO: Define get functions: GetName(), GetBirthYear(), GetDeathYear()
// TODO: Define PrintInfo() function
// If deathYear is entered as -1, only print birthYear
Artwork.h Given:
#ifndef ARTWORKH
#define ARTWORKH
#include "Artist.h"
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
};
#endif
Artwork.cpp Given:
#include "Artwork.h"
#include <iostream>
// TODO: Define default constructor
// TODO: Define second constructor to initialize
// private fields (title, yearCreated, artist)
// TODO: Define get functions: GetTitle(), GetYearCreated()
// TODO: Define PrintInfo() function
// Call the PrintInfo() function in the Artist class to print an artist's information
![File is marked as read only
1 #include "Artist.h"
2 #include "Artwork.h"
3 #include <iostream>
4 #include <string>
5 using namespace std;
6
7 int main() {
8 string userTitle, userArtistName;
9
10
11 getline(cin, userArtistName);
12
cin >> userBirthYear;
13
14
15 cin.ignore();
16 getline(cin, userTitle);
17
cin >> yearCreated;
18
cin.ignore();
19
20
21
22
23
24
25}
int yearCreated, userBirthYear, userDeathYear;
cin.ignore();
cin >> userDeathYear;
Artist userArtist =
Artwork newArtwork
Current file: main.cpp
=
Artist(userArtistName, userBirthYear, userDeathYear);
Artwork(userTitle, yearCreated, userArtist);
newArtwork. PrintInfo();](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F31f4d1c4-6c8c-473c-8672-5a35fdb4a24b%2F6be9829a-ae53-4fe9-90fe-b2bf4a896e78%2F6s14a16_processed.png&w=3840&q=75)
![6.25 LAB: Artwork label (classes/constructors)
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 "unknown" and the years of birth
and death to -1. PrintInfo() displays "Artist:", then a space, then the artist's name, then another space, then the birth and death dates in one
of three formats:
(XXXX to YYYY) if both the birth and death years are nonnegative
• (XXXX to present) if the birth year is nonnegative and the death year is negative
(unknown) 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 default constructor should initialize the title to "unknown", the year created to -1.
PrintInfo() displays an artist's information by calling the PrintInfo() function in the Artist class, followed by the artwork's title and the year
created. 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 to 1973)
Title: Three Musicians, 1921](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F31f4d1c4-6c8c-473c-8672-5a35fdb4a24b%2F6be9829a-ae53-4fe9-90fe-b2bf4a896e78%2F4a3n4qe_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 5 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
I typed your code in exactly as it was typed in your answer and I am getting a lot of errors.
![In file included from Artist.cpp:1:
Artist.h:17:11: note: candidate is: 'int Artist::GetDeathYear () const'
17 |
int GetDeathYear () const;
^~~~~
Artist.h:7:7: note: 'class Artist' defined here
7 class Artist {
^~~~~~
Artist.cpp:30:6: error: no declaration matches `void Artist::PrintInfo()'
30 void Artist::PrintInfo() {
|
In file included from Artist.cpp:1:
Artist.h:19:12: note: candidate is: 'void Artist::PrintInfo() const'
19 |
void PrintInfo() const;
^~~~~~
^~~~~~~~~
Artist.h:7:7: note: 'class Artist' defined here
7 | class Artist{
^~~~~~](https://content.bartleby.com/qna-images/question/31f4d1c4-6c8c-473c-8672-5a35fdb4a24b/a2991a99-aa10-418b-9c06-1dba4f16b1cb/qt1svpca_thumbnail.png)
![Program errors displayed here
Artist.cpp:18:8: error: no declaration matches 'std::string Artist::GetName()'
18 string Artist::GetName() {
I
In file included from Artist.cpp:1:
Artist.h:13:14: note: candidate is: 'std::string Artist::GetName() const'
13 I
string GetName() const;
^~~~~~~
^~~~~~
Artist.h:7:7: note: 'class Artist' defined here
7 | class Artist{
^~~~~~
|
Artist.cpp:22:5: error: no declaration matches 'int Artist::GetBirthYear ()'
22 int Artist::GetBirthYear () {
15 |
|
^~~~~~
In file included from Artist.cpp:1:
Artist.h:15:11: note: candidate is: 'int Artist::GetBirthYear () const'
int GetBirthYear () const;
^~~~ ~~~~~~~
Artist.h: 7:7: note: 'class Artist' defined here
7 class Artist {
^~~~~~
Artist.cpp:26:5: error: no declaration matches 'int Artist::GetDeathYear()'
26 int Artist::GetDeathYear () {
^~~~~~](https://content.bartleby.com/qna-images/question/31f4d1c4-6c8c-473c-8672-5a35fdb4a24b/a2991a99-aa10-418b-9c06-1dba4f16b1cb/ap5zfvg_thumbnail.png)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)