Concept explainers
10.17 LAB: Artwork label (classes/constructors)
Define the Artist class with a constructor to initialize an artist's information and a print_info() method. The constructor should by default initialize the artist's name to "None" and the years of birth and death to 0. print_info() should display Artist Name, born XXXX if the year of death is -1 or Artist Name (XXXX-YYYY) otherwise.
Define the Artwork class with a constructor to initialize an artwork's information and a print_info() method. The constructor should by default initialize the title to "None", the year created to 0, and the artist to use the Artist default constructor parameter values.
Ex: If the input is:
Pablo Picasso
1881
1973
Three Musicians
1921
the output is:
Artist: Pablo Picasso (1881-1973)
Title: Three Musicians, 1921
If the input is:
Brice Marden
1938
-1
Distant Muses
2000
the output is:
Artist: Brice Marden, born 1938
Title: Distant Muses, 2000
Use Python, please.
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 2 images
- C++ Assume that box 1 is an object of a class called Rectangle. Assume that the statement Rectangle box2 = box1 is executed. Which of the following statements is false? a) the default constructor for the Rectangle class is called for box2. b) memberwise assignment occurs unless Rectangle has a copy constructor c) the copy constructor for the Rectangle class is called if Rectangle has a copy constructorarrow_forwardOnly Number 21arrow_forwardMay I please have your assistance with this lab: 2.15 LAB: Artwork label ( modules) Part of the code is correct. I am only needing the code to be correct for the following errors: This is the current code & errors at bottom of code: # Artist.py class Artist: # below is the comstructor to initializez artist infomration # constructor initialize the artist's name to "None" and the years of birth and death to 0 def __init__(self, name='None', birth_year=0, death_year=0): self.name = name self.birth_year = birth_year self.death_year = death_year def print_info(self): if self.birth_year >= 0 and self.death_year >= 0: print(f'Artist: {self.name} ({self.birth_year} to {self.death_year})') elif self.birth_year >= 0: print(f'Artist: {self.name} ({self.birth_year} - present)') else: print(f'Artist: {self.name} (unkown)') # Artwork.py class Artwork:…arrow_forward
- Q5) Write, compiles, and test a class that displays the following pattern on the screen: X X X XXXXX X X X X X X X XXXX Save the class as Q5 X XXXX X X X X X X Xarrow_forwardInstructions-Java Assignment is to define a class named Address. The Address class will have three private instance variables: an int named street_number a String named street_name and a String named state. Write three constructors for the Address class: an empty constructor (no input parameters) that initializes the three instance variables with default values of your choice, a constructor that takes the street values as input but defaults the state to "Arizona", and a constructor that takes all three pieces of information as input Next create a driver class named Main.java. Put public static void main here and test out your class by creating three instances of Address, one using each of the constructors. You can choose the particular address values that are used. I recommend you make them up and do not use actual addresses. Run your code to make sure it works. Next add the following public methods to the Address class and test them from main as you go: Write getters and…arrow_forwardClass Connect6State Cloneable Connect6State - A representation of a Connect6 game state. We assume a square grid board size specified to be a positive integer less than or equal to 26. Size 19 is common. The first and second players place pieces on the board that are black and white, respectively. Each piece is placed in an unoccupied grid position. On the first turn, the first player places one piece. Afterwards, players alternate placing two pieces per turn. Play continues until either one player completes a consecutive line of 6 or more of their pieces or no play is possible. The player with 6 or more pieces in a horizontal, vertical, or diagonal line is the winner. If no legal play is possible, the game is a draw Field Detail BLACK public static final int BLACK a constant indicating a black player/piece See Also:Constant Field Values WHITE public static final int WHITE a constant indicating a white player/piece See Also:Constant Field Values NONE public static final…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education