In: Computer Science
Westward Art Gallery sells artwork that includes paintings, sculptures, and pottery. The gallery tracks the id, title, and artist for each piece of art.
For paintings, the gallery records the media used to create the work. Paintings may be oil, watercolor, pastel, or mixed-media. The gallery also records the painting’s dimensions: length and width. Create an enum for the media. The user should be able to provide an int that will be converted.
For sculptures, the gallery records the material used to create the work. Material may be wood, metal, or plastic. Create an enum for the material. The user should be able to provide an int that will be converted.
For pottery, the gallery records the type of pottery: earthenware, stoneware, porcelain, or ceramic. The gallery also records the dimensions: length, width, and height. Create an enum for the pottery type. The user should be able to provide an int that will be converted.
Implement a print() function in every class that displays the data in the object.
Create a class called Dimensions to store the dimensions of the artworks. This class should be able to store the length, width, and height. Implement a function toString that returns the dimensions as a string one of the following formats:
//all 3 values set 5 X 4 X 2 //no height set 5 X 4
Create an inheritance-based collection of classes to represent these different types of art. Remember to include error checking.
Sample Output:
Art: Artwork ID: 234
Title: Dahli at Work
Artist: Unknown
Painting:
Artwork ID: 123
Title: Man with Beer
Artist: Dietrick Buttler
Media: Pastel
Dimensions: 3 X 6
Pottery:
Artwork ID: 242
Title: Jade Head
Artist: Unknown
Type: Stoneware Dimensions: 2 X 3 X 1
Sculptures: Artwork ID: 24214
Title: Everlast Artist: Bernini
Material: Wood
You are given one Cpp(Artwork.cpp) file that must remain unchanged. Needed is a Art,Pottery,paintings,sculptures .cpp and .h files
Included code:
/**
* Do no edit this file
**/
#include "Paintings.h"
#include "Pottery.h"
#include "Sculptures.h"
#include <iostream>
using namespace std;
int main()
{
Art a(234, "Dahli at Work", "Unknown");
Paintings painting (123, "Man with Beer", "Dietrick Buttler", 2, 3,
6);
Pottery vase(242, "Jade Head", "Unknown", 1, 2, 3, 1);
Sculptures s (24214, "Everlast", "Bernini", 0);
cout << "Art: " << endl;
a.print();
cout << endl << endl << "Painting: " <<
endl;
painting.print();
cout << endl << endl << "Pottery: " <<
endl;
vase.print();
cout << endl << endl << "Sculptures: "
<< endl;
s.print();
return 0;
}
Hope the instructions are clear thank you
Art.h
#pragma once
#include <string>
#include <iostream>
using namespace std;
class Art
{
public:
int m_id;
string m_title;
string m_artist;
public:
Art(int id, string title, string artist)
{
m_id = id;
m_title = title;
m_artist = artist;
}
void print()
{
cout << "Artwork ID : " << m_id << endl;
cout << "Title : " << m_title << endl;
cout << "Artist : " << m_artist << endl;
}
~Art()
{
}
};
Artwork.cpp
#include "Paintings.h"
#include "Pottery.h"
#include "Sculptures.h"
#include <iostream>
#include "Art.h"
using namespace std;
int main()
{
Art a(234, "Dahli at Work", "Unknown");
cout << "Art: " << endl;
a.print();
Paintings painting(123, "Man with Beer", "Dietrick Buttler", 2, 3, 6);
Pottery vase(242, "Jade Head", "Unknown", 1, 2, 3, 1);
Sculptures s(24214, "Everlast", "Bernini", 0);
cout << endl << endl << "Painting: " << endl;
painting.print();
cout << endl << endl << "Pottery: " << endl;
vase.print();
cout << endl << endl << "Sculptures: " << endl;
s.print();
return 0;
}
Paintings.h
#pragma once
enum media{ oil, watercolor, pastel, mixed_media };
#include "Art.h"
#include "Dimensions.h"
#include <map>
#include <iostream>
using namespace std;
class Paintings : public Art,Dimensions
{
public:
map<int, string>m;
int m_media_type;
void init()
{
media med = oil;
m.insert({ med,"oil" });
med = watercolor;
m.insert({ med,"watercolor" });
med = pastel;
m.insert({ med,"pastel" });
med = mixed_media;
m.insert({ med,"mixed_media" });
}
Paintings(int id, string title, string artist,int media_type, int height, int width , int length ):Art(id,title,artist),Dimensions(height,width,length)
{
m_media_type = media_type;
init();
}
Paintings(int id, string title, string artist, int media_type, int width , int length) :Art(id, title, artist), Dimensions(0, width, length)
{
m_media_type = media_type;
init();
}
~Paintings()
{
}
void print()
{
Art::print();
cout << "Media: " << m[m_media_type] << endl;
cout << "D
Dimensions: "<< Dimensions::toString();
}
Pottery.h
#pragma once
enum pottery_type{ earthenware, stoneware, porcelain, ceramic };
#include <iostream>
using namespace std;
#include <string>
#include "Dimensions.h"
#include "Art.h"
#include <map>
class Pottery: public Art,Dimensions
{
public:
int m_pot_type;
map<int, string> m;
void init()
{
pottery_type p = earthenware;
m.insert({ p,"earthenware" });
p = stoneware;
m.insert({ p,"stoneware" });
p = porcelain;
m.insert({ p,"porcelain" });
p = ceramic;
m.insert({ p,"ceramic" });
}
Pottery(int id, string title, string artist, int pottery_type,int height, int width, int length) :Art(id, title, artist), Dimensions(height, width, length)
{
m_pot_type = pottery_type;
init();
}
Pottery(int id, string title, string artist, int pottery_type, int width, int length) :Art(id, title, artist), Dimensions(0, width, length)
{
m_pot_type = pottery_type;
init();
}
~Pottery()
{
}
void print()
{
Art::print();
cout << "Type: " << m[m_pot_type] << endl;
cout << "Dimensions: " << Dimensions::toString();
}
};
};
Sculpture.h
#pragma once
enum Material { wood, metal, plastic};
#include "Art.h"
#include <map>
class Sculptures: public Art
{
public:
int m_Material_type;
map<int, string>m;
void init()
{
Material med = wood;
m.insert({ med,"wood" });
med = metal;
m.insert({ med,"metal" });
med = plastic;
m.insert({ med,"plastic" });
}
Sculptures(int id, string title, string artist, int MaterialType) :Art(id, title, artist)
{
m_Material_type = MaterialType;
init();
}
~Sculptures()
{
}
void print()
{
Art::print();
cout << "Material: " << m[m_Material_type]<<endl;
}
};
Dimensions.cpp
#include "Dimensions.h"
Dimensions::Dimensions(int height,int width,int length)
{
m_height = height;
m_width = width;
m_length = length;
}
Dimensions::~Dimensions()
{
}
string Dimensions::toString()
{
string dimension = "";
if (m_height)
{
dimension += to_string(m_height);
}
if (m_width)
{
dimension += to_string(m_width);
}
if (m_length)
{
dimension += to_string(m_length);
}
return dimension;
}
Dimensions.h
#pragma once
#include <string>
using namespace std;
class Dimensions
{
private:
int m_height, m_width, m_length;
public:
Dimensions(int height, int width, int length);
~Dimensions();
string toString();
};