Home / Expert Answers / Computer Science / please-use-c-to-complete-artist-h-artist-cpp-artwork-h-and-artwork-cpp-files-main-cpp-cannot-b-pa354

(Solved): Please use C++ to complete Artist.h, Artist.cpp, Artwork.h, and Artwork.cpp files. Main.cpp cannot b ...



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  

6.25 LAB: Artwork label (classes/constructors)
Given main(), complete the Artist class (in files Artist.h and Artist.cpp) wit

 

File is marked as read only
1 #include Artist.h
2 #include Artwork.h
3 #include <iostream>
4 #include <string>
5 using na

 

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 File is marked as read only 1 #include "Artist.h" 2 #include "Artwork.h" 3 #include 4 #include 5 using namespace std; 6 7 int main() { 8 string userTitle, userArtistName; 9 int yearCreated, userBirthYear, userDeathYear; 10 11 getline(cin, userArtistName); 12 cin userBirthYear; 13 cin.ignore(); 14 cin >> userDeathYear; 15 cin.ignore(); 16 getline(cin, userTitle); 17 cin >> yearCreated; 18 cin.ignore(); 19 ????? ? 20 21 22 Artist userArtist= Current file: main.cpp 23 24 newArtwork. PrintInfo(); 25} st(userArtistName, userBirthYear, userDeathYear); Artwork newArtwork = Artwork(userTitle, yearCreated, userArtist);


We have an Answer from Expert

View Expert Answer

Expert Answer


Hi Here is the required code: main.cpp #include "Artist.h" #include "Artwork.h" #include #include using namespace std; int main() { string userTitle, userArtistName; int yearCreated, userBirthYear, userDeathYear; get
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe