SlideShare a Scribd company logo
C++
10.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:
1881 and 1973 being the birth and death years respectively, with 1921 being the year the work
was created, the output is:
Ex: If the input is:
the output is:
Ex: If the input is:
the output is:
Code provided, fill in where needed on each (there is comments) .cpp or .h:
main.cpp:
#include "Artist.h"
#include "Artwork.h"
#include <iostream>
#include <string>
using namespace std;
int main() {
string userTitle, userArtistName;
int yearCreated, userBirthYear, userDeathYear;
getline(cin, userArtistName);
getline(cin, userTitle);
cin >> userBirthYear;
cin >> userDeathYear;
cin >> yearCreated;
Artist userArtist = Artist(userArtistName, userBirthYear, userDeathYear);
Artwork newArtwork = Artwork(userTitle, yearCreated, userArtist);
newArtwork.PrintInfo();
}
Artist.h:
#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:
#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:
#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:
#include "Artwork.h"
#include <iostream>
// TODO: Define default constructor
Artwork::Artwork()
{
title = "";
yearCreated = 0;
}
// TODO: Define second constructor to initialize
// private fields (title, yearCreated, artist)
Artwork::Artwork(string title, int yearCreated, Artist artist)
{
this->title = title;
this->yearCreated = yearCreated;
this->artist = artist;
}

More Related Content

Similar to C++ 10-25 LAB- Artwork label (classes-constructors) Given main()- comp.docx

C++ Programming Search A Linked ListThe Content of songlist.txt.pdf
C++ Programming Search A Linked ListThe Content of songlist.txt.pdfC++ Programming Search A Linked ListThe Content of songlist.txt.pdf
C++ Programming Search A Linked ListThe Content of songlist.txt.pdf
herminaherman
 
Mouse programming in c
Mouse programming in cMouse programming in c
Mouse programming in cgkgaur1987
 
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdfIn C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
stopgolook
 
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdfNeed done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
info114
 
PFB cpp code for the given problem#include iostream #include .pdf
PFB cpp code for the given problem#include iostream #include .pdfPFB cpp code for the given problem#include iostream #include .pdf
PFB cpp code for the given problem#include iostream #include .pdf
mailadmin1
 
constructors
constructorsconstructors
constructors
DeepikaT13
 
Python crush course
Python crush coursePython crush course
Python crush course
Mohammed El Rafie Tarabay
 
OOP-Lecture-05 (Constructor_Destructor).pptx
OOP-Lecture-05 (Constructor_Destructor).pptxOOP-Lecture-05 (Constructor_Destructor).pptx
OOP-Lecture-05 (Constructor_Destructor).pptx
SirRafiLectures
 
Need to be done in C++ Please Sorted number list implementation wit.pdf
Need to be done in C++  Please   Sorted number list implementation wit.pdfNeed to be done in C++  Please   Sorted number list implementation wit.pdf
Need to be done in C++ Please Sorted number list implementation wit.pdf
aathiauto
 
Ch 4
Ch 4Ch 4
Ch 4
AMIT JAIN
 
Chapter 7 - Input Output Statements in C++
Chapter 7 - Input Output Statements in C++Chapter 7 - Input Output Statements in C++
Chapter 7 - Input Output Statements in C++Deepak Singh
 
Dynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Dynamic Objects,Pointer to function,Array & Pointer,Character String ProcessingDynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Dynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Meghaj Mallick
 
Need to be done in C Please Sorted number list implementation with.pdf
Need to be done in C  Please   Sorted number list implementation with.pdfNeed to be done in C  Please   Sorted number list implementation with.pdf
Need to be done in C Please Sorted number list implementation with.pdf
aathmaproducts
 
Hive Functions Cheat Sheet
Hive Functions Cheat SheetHive Functions Cheat Sheet
Hive Functions Cheat Sheet
Hortonworks
 
The Ring programming language version 1.8 book - Part 94 of 202
The Ring programming language version 1.8 book - Part 94 of 202The Ring programming language version 1.8 book - Part 94 of 202
The Ring programming language version 1.8 book - Part 94 of 202
Mahmoud Samir Fayed
 
Function for python for the embedded system
Function for python for the embedded systemFunction for python for the embedded system
Function for python for the embedded system
julasit
 
Presentation
PresentationPresentation
Presentation
manogallery
 
1817 LAB Playlist output linked list Given main compl.pdf
1817 LAB Playlist output linked list Given main compl.pdf1817 LAB Playlist output linked list Given main compl.pdf
1817 LAB Playlist output linked list Given main compl.pdf
spshotham
 
programming language in c&c++
programming language in c&c++programming language in c&c++
programming language in c&c++
Haripritha
 
Write a new version of the area calculation program that makes use of.docx
 Write a new version of the area calculation program that makes use of.docx Write a new version of the area calculation program that makes use of.docx
Write a new version of the area calculation program that makes use of.docx
ajoy21
 

Similar to C++ 10-25 LAB- Artwork label (classes-constructors) Given main()- comp.docx (20)

C++ Programming Search A Linked ListThe Content of songlist.txt.pdf
C++ Programming Search A Linked ListThe Content of songlist.txt.pdfC++ Programming Search A Linked ListThe Content of songlist.txt.pdf
C++ Programming Search A Linked ListThe Content of songlist.txt.pdf
 
Mouse programming in c
Mouse programming in cMouse programming in c
Mouse programming in c
 
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdfIn C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
In C++ please, do not alter node.hStep 1 Inspect the Node.h file.pdf
 
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdfNeed done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
 
PFB cpp code for the given problem#include iostream #include .pdf
PFB cpp code for the given problem#include iostream #include .pdfPFB cpp code for the given problem#include iostream #include .pdf
PFB cpp code for the given problem#include iostream #include .pdf
 
constructors
constructorsconstructors
constructors
 
Python crush course
Python crush coursePython crush course
Python crush course
 
OOP-Lecture-05 (Constructor_Destructor).pptx
OOP-Lecture-05 (Constructor_Destructor).pptxOOP-Lecture-05 (Constructor_Destructor).pptx
OOP-Lecture-05 (Constructor_Destructor).pptx
 
Need to be done in C++ Please Sorted number list implementation wit.pdf
Need to be done in C++  Please   Sorted number list implementation wit.pdfNeed to be done in C++  Please   Sorted number list implementation wit.pdf
Need to be done in C++ Please Sorted number list implementation wit.pdf
 
Ch 4
Ch 4Ch 4
Ch 4
 
Chapter 7 - Input Output Statements in C++
Chapter 7 - Input Output Statements in C++Chapter 7 - Input Output Statements in C++
Chapter 7 - Input Output Statements in C++
 
Dynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Dynamic Objects,Pointer to function,Array & Pointer,Character String ProcessingDynamic Objects,Pointer to function,Array & Pointer,Character String Processing
Dynamic Objects,Pointer to function,Array & Pointer,Character String Processing
 
Need to be done in C Please Sorted number list implementation with.pdf
Need to be done in C  Please   Sorted number list implementation with.pdfNeed to be done in C  Please   Sorted number list implementation with.pdf
Need to be done in C Please Sorted number list implementation with.pdf
 
Hive Functions Cheat Sheet
Hive Functions Cheat SheetHive Functions Cheat Sheet
Hive Functions Cheat Sheet
 
The Ring programming language version 1.8 book - Part 94 of 202
The Ring programming language version 1.8 book - Part 94 of 202The Ring programming language version 1.8 book - Part 94 of 202
The Ring programming language version 1.8 book - Part 94 of 202
 
Function for python for the embedded system
Function for python for the embedded systemFunction for python for the embedded system
Function for python for the embedded system
 
Presentation
PresentationPresentation
Presentation
 
1817 LAB Playlist output linked list Given main compl.pdf
1817 LAB Playlist output linked list Given main compl.pdf1817 LAB Playlist output linked list Given main compl.pdf
1817 LAB Playlist output linked list Given main compl.pdf
 
programming language in c&c++
programming language in c&c++programming language in c&c++
programming language in c&c++
 
Write a new version of the area calculation program that makes use of.docx
 Write a new version of the area calculation program that makes use of.docx Write a new version of the area calculation program that makes use of.docx
Write a new version of the area calculation program that makes use of.docx
 

More from BrianGHiNewmanv

Cai Corporation uses a job-order costing system and has provided the f.docx
Cai Corporation uses a job-order costing system and has provided the f.docxCai Corporation uses a job-order costing system and has provided the f.docx
Cai Corporation uses a job-order costing system and has provided the f.docx
BrianGHiNewmanv
 
Cabana Cruise Line uses a combination of debt and equity to fund opera.docx
Cabana Cruise Line uses a combination of debt and equity to fund opera.docxCabana Cruise Line uses a combination of debt and equity to fund opera.docx
Cabana Cruise Line uses a combination of debt and equity to fund opera.docx
BrianGHiNewmanv
 
C-{2-8-10}.docx
C-{2-8-10}.docxC-{2-8-10}.docx
C-{2-8-10}.docx
BrianGHiNewmanv
 
C++ Programming! Make sure to divide the program into 3 files the head.docx
C++ Programming! Make sure to divide the program into 3 files the head.docxC++ Programming! Make sure to divide the program into 3 files the head.docx
C++ Programming! Make sure to divide the program into 3 files the head.docx
BrianGHiNewmanv
 
C++ Please write the whole code that is needed for this assignment- wr.docx
C++ Please write the whole code that is needed for this assignment- wr.docxC++ Please write the whole code that is needed for this assignment- wr.docx
C++ Please write the whole code that is needed for this assignment- wr.docx
BrianGHiNewmanv
 
By researching online find information about 2 malware samples that we.docx
By researching online find information about 2 malware samples that we.docxBy researching online find information about 2 malware samples that we.docx
By researching online find information about 2 malware samples that we.docx
BrianGHiNewmanv
 
By which of the following processes are bacteria known to produce-acqu.docx
By which of the following processes are bacteria known to produce-acqu.docxBy which of the following processes are bacteria known to produce-acqu.docx
By which of the following processes are bacteria known to produce-acqu.docx
BrianGHiNewmanv
 
BONUS PROBLEM ( 3 points) Ed owns 1-200 shares of ABC Corp- The compan.docx
BONUS PROBLEM ( 3 points) Ed owns 1-200 shares of ABC Corp- The compan.docxBONUS PROBLEM ( 3 points) Ed owns 1-200 shares of ABC Corp- The compan.docx
BONUS PROBLEM ( 3 points) Ed owns 1-200 shares of ABC Corp- The compan.docx
BrianGHiNewmanv
 
Business ethics- 12- Introduce the abuse of official position concept.docx
Business ethics- 12- Introduce  the abuse of official position concept.docxBusiness ethics- 12- Introduce  the abuse of official position concept.docx
Business ethics- 12- Introduce the abuse of official position concept.docx
BrianGHiNewmanv
 
Building a strong and ethical IT policy requires the cooperation of al.docx
Building a strong and ethical IT policy requires the cooperation of al.docxBuilding a strong and ethical IT policy requires the cooperation of al.docx
Building a strong and ethical IT policy requires the cooperation of al.docx
BrianGHiNewmanv
 
Building a Project WBS and Schedule in MS Project Define Toy Requireme.docx
Building a Project WBS and Schedule in MS Project Define Toy Requireme.docxBuilding a Project WBS and Schedule in MS Project Define Toy Requireme.docx
Building a Project WBS and Schedule in MS Project Define Toy Requireme.docx
BrianGHiNewmanv
 
Briefly compare-contrast right cerebral hemisphere versus left cerebra.docx
Briefly compare-contrast right cerebral hemisphere versus left cerebra.docxBriefly compare-contrast right cerebral hemisphere versus left cerebra.docx
Briefly compare-contrast right cerebral hemisphere versus left cerebra.docx
BrianGHiNewmanv
 
Briefly compare-contrast resting potential versus action potential- In.docx
Briefly compare-contrast resting potential versus action potential- In.docxBriefly compare-contrast resting potential versus action potential- In.docx
Briefly compare-contrast resting potential versus action potential- In.docx
BrianGHiNewmanv
 
Brite Toothbrushes has gathered the following information to complete.docx
Brite Toothbrushes has gathered the following information to complete.docxBrite Toothbrushes has gathered the following information to complete.docx
Brite Toothbrushes has gathered the following information to complete.docx
BrianGHiNewmanv
 
Bridgeport Corporation engaged in the following cash transactions duri.docx
Bridgeport Corporation engaged in the following cash transactions duri.docxBridgeport Corporation engaged in the following cash transactions duri.docx
Bridgeport Corporation engaged in the following cash transactions duri.docx
BrianGHiNewmanv
 
BONUS- If you removed calcium (Ca2+) from a tissue's extracellular env.docx
BONUS- If you removed calcium (Ca2+) from a tissue's extracellular env.docxBONUS- If you removed calcium (Ca2+) from a tissue's extracellular env.docx
BONUS- If you removed calcium (Ca2+) from a tissue's extracellular env.docx
BrianGHiNewmanv
 
BONUS- If you rmoved calcium (Ca2+) from a tissue's extracellular envi.docx
BONUS- If you rmoved calcium (Ca2+) from a tissue's extracellular envi.docxBONUS- If you rmoved calcium (Ca2+) from a tissue's extracellular envi.docx
BONUS- If you rmoved calcium (Ca2+) from a tissue's extracellular envi.docx
BrianGHiNewmanv
 
BONUS- If you removed calcium (Ca2+) from a tissue's extracellular env (1).docx
BONUS- If you removed calcium (Ca2+) from a tissue's extracellular env (1).docxBONUS- If you removed calcium (Ca2+) from a tissue's extracellular env (1).docx
BONUS- If you removed calcium (Ca2+) from a tissue's extracellular env (1).docx
BrianGHiNewmanv
 
Bob paid $100 for a utility bill- Which of the following accounts will.docx
Bob paid $100 for a utility bill- Which of the following accounts will.docxBob paid $100 for a utility bill- Which of the following accounts will.docx
Bob paid $100 for a utility bill- Which of the following accounts will.docx
BrianGHiNewmanv
 
Blood Circulation Across 1- supply blood to the upper limbs Down 3- ca.docx
Blood Circulation Across 1- supply blood to the upper limbs Down 3- ca.docxBlood Circulation Across 1- supply blood to the upper limbs Down 3- ca.docx
Blood Circulation Across 1- supply blood to the upper limbs Down 3- ca.docx
BrianGHiNewmanv
 

More from BrianGHiNewmanv (20)

Cai Corporation uses a job-order costing system and has provided the f.docx
Cai Corporation uses a job-order costing system and has provided the f.docxCai Corporation uses a job-order costing system and has provided the f.docx
Cai Corporation uses a job-order costing system and has provided the f.docx
 
Cabana Cruise Line uses a combination of debt and equity to fund opera.docx
Cabana Cruise Line uses a combination of debt and equity to fund opera.docxCabana Cruise Line uses a combination of debt and equity to fund opera.docx
Cabana Cruise Line uses a combination of debt and equity to fund opera.docx
 
C-{2-8-10}.docx
C-{2-8-10}.docxC-{2-8-10}.docx
C-{2-8-10}.docx
 
C++ Programming! Make sure to divide the program into 3 files the head.docx
C++ Programming! Make sure to divide the program into 3 files the head.docxC++ Programming! Make sure to divide the program into 3 files the head.docx
C++ Programming! Make sure to divide the program into 3 files the head.docx
 
C++ Please write the whole code that is needed for this assignment- wr.docx
C++ Please write the whole code that is needed for this assignment- wr.docxC++ Please write the whole code that is needed for this assignment- wr.docx
C++ Please write the whole code that is needed for this assignment- wr.docx
 
By researching online find information about 2 malware samples that we.docx
By researching online find information about 2 malware samples that we.docxBy researching online find information about 2 malware samples that we.docx
By researching online find information about 2 malware samples that we.docx
 
By which of the following processes are bacteria known to produce-acqu.docx
By which of the following processes are bacteria known to produce-acqu.docxBy which of the following processes are bacteria known to produce-acqu.docx
By which of the following processes are bacteria known to produce-acqu.docx
 
BONUS PROBLEM ( 3 points) Ed owns 1-200 shares of ABC Corp- The compan.docx
BONUS PROBLEM ( 3 points) Ed owns 1-200 shares of ABC Corp- The compan.docxBONUS PROBLEM ( 3 points) Ed owns 1-200 shares of ABC Corp- The compan.docx
BONUS PROBLEM ( 3 points) Ed owns 1-200 shares of ABC Corp- The compan.docx
 
Business ethics- 12- Introduce the abuse of official position concept.docx
Business ethics- 12- Introduce  the abuse of official position concept.docxBusiness ethics- 12- Introduce  the abuse of official position concept.docx
Business ethics- 12- Introduce the abuse of official position concept.docx
 
Building a strong and ethical IT policy requires the cooperation of al.docx
Building a strong and ethical IT policy requires the cooperation of al.docxBuilding a strong and ethical IT policy requires the cooperation of al.docx
Building a strong and ethical IT policy requires the cooperation of al.docx
 
Building a Project WBS and Schedule in MS Project Define Toy Requireme.docx
Building a Project WBS and Schedule in MS Project Define Toy Requireme.docxBuilding a Project WBS and Schedule in MS Project Define Toy Requireme.docx
Building a Project WBS and Schedule in MS Project Define Toy Requireme.docx
 
Briefly compare-contrast right cerebral hemisphere versus left cerebra.docx
Briefly compare-contrast right cerebral hemisphere versus left cerebra.docxBriefly compare-contrast right cerebral hemisphere versus left cerebra.docx
Briefly compare-contrast right cerebral hemisphere versus left cerebra.docx
 
Briefly compare-contrast resting potential versus action potential- In.docx
Briefly compare-contrast resting potential versus action potential- In.docxBriefly compare-contrast resting potential versus action potential- In.docx
Briefly compare-contrast resting potential versus action potential- In.docx
 
Brite Toothbrushes has gathered the following information to complete.docx
Brite Toothbrushes has gathered the following information to complete.docxBrite Toothbrushes has gathered the following information to complete.docx
Brite Toothbrushes has gathered the following information to complete.docx
 
Bridgeport Corporation engaged in the following cash transactions duri.docx
Bridgeport Corporation engaged in the following cash transactions duri.docxBridgeport Corporation engaged in the following cash transactions duri.docx
Bridgeport Corporation engaged in the following cash transactions duri.docx
 
BONUS- If you removed calcium (Ca2+) from a tissue's extracellular env.docx
BONUS- If you removed calcium (Ca2+) from a tissue's extracellular env.docxBONUS- If you removed calcium (Ca2+) from a tissue's extracellular env.docx
BONUS- If you removed calcium (Ca2+) from a tissue's extracellular env.docx
 
BONUS- If you rmoved calcium (Ca2+) from a tissue's extracellular envi.docx
BONUS- If you rmoved calcium (Ca2+) from a tissue's extracellular envi.docxBONUS- If you rmoved calcium (Ca2+) from a tissue's extracellular envi.docx
BONUS- If you rmoved calcium (Ca2+) from a tissue's extracellular envi.docx
 
BONUS- If you removed calcium (Ca2+) from a tissue's extracellular env (1).docx
BONUS- If you removed calcium (Ca2+) from a tissue's extracellular env (1).docxBONUS- If you removed calcium (Ca2+) from a tissue's extracellular env (1).docx
BONUS- If you removed calcium (Ca2+) from a tissue's extracellular env (1).docx
 
Bob paid $100 for a utility bill- Which of the following accounts will.docx
Bob paid $100 for a utility bill- Which of the following accounts will.docxBob paid $100 for a utility bill- Which of the following accounts will.docx
Bob paid $100 for a utility bill- Which of the following accounts will.docx
 
Blood Circulation Across 1- supply blood to the upper limbs Down 3- ca.docx
Blood Circulation Across 1- supply blood to the upper limbs Down 3- ca.docxBlood Circulation Across 1- supply blood to the upper limbs Down 3- ca.docx
Blood Circulation Across 1- supply blood to the upper limbs Down 3- ca.docx
 

Recently uploaded

CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 

Recently uploaded (20)

CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 

C++ 10-25 LAB- Artwork label (classes-constructors) Given main()- comp.docx

  • 1. C++ 10.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: 1881 and 1973 being the birth and death years respectively, with 1921 being the year the work was created, the output is: Ex: If the input is: the output is: Ex: If the input is: the output is: Code provided, fill in where needed on each (there is comments) .cpp or .h: main.cpp: #include "Artist.h" #include "Artwork.h" #include <iostream> #include <string> using namespace std;
  • 2. int main() { string userTitle, userArtistName; int yearCreated, userBirthYear, userDeathYear; getline(cin, userArtistName); getline(cin, userTitle); cin >> userBirthYear; cin >> userDeathYear; cin >> yearCreated; Artist userArtist = Artist(userArtistName, userBirthYear, userDeathYear); Artwork newArtwork = Artwork(userTitle, yearCreated, userArtist); newArtwork.PrintInfo(); } Artist.h: #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
  • 3. Artist.cpp: #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: #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:
  • 4. #include "Artwork.h" #include <iostream> // TODO: Define default constructor Artwork::Artwork() { title = ""; yearCreated = 0; } // TODO: Define second constructor to initialize // private fields (title, yearCreated, artist) Artwork::Artwork(string title, int yearCreated, Artist artist) { this->title = title; this->yearCreated = yearCreated; this->artist = artist; }