Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

An art gallery wants to manage its collection of paintings and painters more efficiently. They would like to create a Python program to help with

An art gallery wants to manage its collection of paintings and painters more efficiently. They would like to create a Python program to help with this task. The following requirements need to be implemented:
Create a Painter class with the following instance attributes:# Testing the implementation
if _=="":
# Create painters
hundert = Painter("Hundertwasser", "December 15,1928", "Austria")
pollock = Painter("Pollock", "January 28,1912","U.S.")
# Create a gallery
gallery = Gallery ()
# Hundertwasser paintings
hundert.paint("The Way to You", "1966")
hundert.paint("The Second Skin", "1986")
# Pollock paintings
pollock.paint("Alchemy","1947")
pollock.paint ("Convergence","1952")
# Confirm that the gallery is empty
gallery.list_paintings()
print()
# Add paintings to the gallery
for painter in Painter.all_painters:
for painting in painter.paintings:
gallery.add_painting(painting)
print()
# Try adding duplicate
gallery.add_painting(pollock.paintings[0])
print()
# List paintings in the gallery
gallery.list_paintings()
name (the artists name)
dob (the authors date of birth)
nationality (the authors nationality)
paintings (a list to store all paintings created by the artist)
The Painter class must also have a list named all_painters that stores all Painter objects that get instantiated. Be sure to add the painter to this list when a new painter is created (in the __init__ method). This list will be used to add paintings to the gallery collection.
Create a method named paint() in the Painter class that takes the following parameters:
title (the title of the artwork)
year (the year the painting was created)
The paint() method in the Painter class must create a new Painting object (described below) with the Painter instance as its painter and add it to the painters list of paintings.
Create a Painting class with the following instance attributes:
title (the title of the painting)
painter (an instance of the Painter class)
year (the year the painting was created)
The Painting class must also have a list named all_paintings that stores all Painting objects that get instantiated. Be sure to add the painting to this list when a new painting is created (in the __init__ method). This list will be used to add paintings to the gallery collection.
The Painting class must override the __str__() method to return the paintings details in this format:
Title: , Artist: , year: .
Finally, create a Gallery class with the following instance attributes:
collection (a list to store all of the paintings in the gallery)
Create a method named add_painting() in the Gallery class that takes a Painting object as a parameter and adds it to the gallerys collection. Ensure that duplicate paintings are not added to the collection.
Display a message that indicates the painting (paintings title and artists name) was added to the gallery if it does not already have it in its collection or an alternative message if it is already part of the collection.
Create a method named list_paintings() in the Gallery class that displays all of the paintings in the gallerys collection.
If the gallery does not have any artworks in the collection, it should state so.
Your program should demonstrate the creation of multiple Painter objects, a single Gallery object, multiple Painting objects using the paint() method in the Painter class, add all of the paintings to a Gallery object, and show usage of the list_paintings() method to display the gallerys collection. Use the code provided in the first screenshot below to test your implementation. This code should go at the end of your program after you have satisfied all of the requirements above.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 25th European Conference Adbis 2021 Tartu Estonia August 24 26 2021 Proceedings Lncs 12843

Authors: Ladjel Bellatreche ,Marlon Dumas ,Panagiotis Karras ,Raimundas Matulevicius

1st Edition

3030824713, 978-3030824716

More Books

Students also viewed these Databases questions

Question

Identify conflict triggers in yourself and others

Answered: 1 week ago