Question

In: Computer Science

Every answer shown for this question appears to be giving an error message or locking the...

Every answer shown for this question appears to be giving an error message or locking the database or telling me there is an operational error or undefined parameter of some sort. Here is the question. This is for Python3

Define the Artist class in Artist.py with a constructor to initialize an artist's information. The constructor should by default initialize the artist's name to "None" and the years of birth and death to 0.

Define the Artwork class in Artwork.py with a constructor to initialize an artwork's information. 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. Add an import statement to import the Artist class.

Add import statements to main.py to import the Artist and Artwork classes.

if this is input:

Pablo Picasso

1881

1973

Three Musicians

1921

what is output

Solutions

Expert Solution


As per the problem statement I have solve the problem. Please let me know if you have any doubts or you want me to modify the answer. And if you find this answer useful then don't forget to rate my answer as thumps up. Thank you! :)


Code:
//main.py

# import artist class
from Artist import Artist
# import artwork class
from Artwork import Artwork
# main
if __name__ == "__main__":
    # artist name
    artist_name = input()
    # artist birth year
    artist_birth_year = int(input())
    # artist death year
    artist_death_year = int(input())
    # artist creativity title
    user_title = input()
    # year when artist made creativity
    year_created = int(input())

    # artist details
    artist = Artist(artist_name, artist_birth_year, artist_death_year)
  
    #artist artwork details
    artwork = Artwork(user_title, year_created, artist)

    artwork.print_info()

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//artist.py

# class artist
class Artist:


    # artist birth year and death year
    def __init__(self, name = 'None', birth_year = 0, death_year = 0):
        self.name = name
        self.birth_year = birth_year
        self.death_year = death_year

    # artist info
    def print_info(self):
        if self.death_year == -1:
            print('Artist: {}, born {}'.format(self.name, self.birth_year))
        else:
            print('Artist: {} ({}-{})'.format(self.name, self.birth_year, self.death_year))
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//Artwork.py

# class artist
class Artist:


    # artist birth year and death year
    def __init__(self, name = 'None', birth_year = 0, death_year = 0):
        self.name = name
        self.birth_year = birth_year
        self.death_year = death_year

    # artist info
    def print_info(self):
        if self.death_year == -1:
            print('Artist: {}, born {}'.format(self.name, self.birth_year))
        else:
            print('Artist: {} ({}-{})'.format(self.name, self.birth_year, self.death_year))

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Program Output:


Related Solutions

What caused the following error message to appear in Microsoft access do not merely state the name of the error indicate why the error occurred and what the user was doing when this message appeared?
What caused the following error message to appear in Microsoft access do not merely state the name of the error indicate why the error occurred and what the user was doing when this message appeared?
All of the following statements are false. Please determine the error and rewrite teh answer giving completely correct information.
All of the following statements are false. Please determine the error and rewrite teh answer giving completely correct information.1. To calculate a syringe dose, read the fluid level from the tip of the plunger just above the calibration mark.2. A tuberculin syringe is calibrated in units only.3. Usually only solutions of 2 to 3ml are given subcutaneously.4. The most common insulin syringe is called the U-50.5. Heparin is normally given using an insulin syringe.6. The typical intramuscular syringe holds 100...
IM GETTING A ERROR MESSAGE : if rentalCode == 'W' and averageMiles <= 900: mileCharge =...
IM GETTING A ERROR MESSAGE : if rentalCode == 'W' and averageMiles <= 900: mileCharge = weeksRented * 100.00 else: Collect Customer Data - Part 2 Collect Mileage information: Prompt: "Starting Odometer Reading:\n" Variable: odoStart = ? Prompt: "Ending Odometer Reading:\n" Variable: odoEnd = ? Add code to PRINT odoStart and odoEnd variables as well as the totalMiles to check your work. The following data will be used as input in the test: odoStart = 1234 odoEnd = 2222 Collect...
Use the following information to answer Question 24 to Question 25: A poll was taken every...
Use the following information to answer Question 24 to Question 25: A poll was taken every month on how voters will vote on the next federal election. Here are the results of the poll: Sample Size Liberal Voters This Month 550 324 Last Month 700 406 24. (4 points) Develop a 95% confidence interval estimate for the difference between the proportions of voters who will vote for the Liberals in the two populations. Show your calculations. 25. (2 points) From...
William is attempting to sign in to his operating system but he receives an error message...
William is attempting to sign in to his operating system but he receives an error message stating that he has entered an invalid password. How can he solve this problem?
I'm getting an error message with this code and I don't know how to fix it...
I'm getting an error message with this code and I don't know how to fix it The ones highlighted give me error message both having to deal Scanner input string being converted to an int. I tried changing the input variable to inputText because the user will input a number and not a character or any words. So what can I do to deal with this import java.util.Scanner; public class Project4 { /** * @param args the command line arguments...
Please answer all with clear explanation, Thanks. Question 6.In addition to giving information, according to the...
Please answer all with clear explanation, Thanks. Question 6.In addition to giving information, according to the principles of teaching and learning, allnurses should be prepared to (Points : 5) 1. assess learning needs, readiness, and styles. 2. determine whether the information has been received and understood. 3. revise the approach to teaching if the client does not comprehend the information. 4. All of the above Question 8.Which are two ways to decrease a behavior or response? (Points : 5) 1.Avoidance...
In python can you fix the error in the line where it says message = input("Input...
In python can you fix the error in the line where it says message = input("Input a lowercase sentence: ") this is the error message I get after running the program and inputing a lowercase sentence Input a lowercase sentence:hello hi MM§MTraceback (most recent call last): MM§M File "client.py", line 14, in <module> MM§M message = input("Input a lowercase sentence:") MM§M File "<string>", line 1 MM§M hello hi MM§M ^ MM§MSyntaxError: unexpected EOF while parsing from socket import * #...
What is the error message that occurs when the manager sends Set_Request to a read-only object?...
What is the error message that occurs when the manager sends Set_Request to a read-only object? Also, list out any three error messages in SNMP v1.
die's job is to output an error message alarmingly and terminate the program. You may copy...
die's job is to output an error message alarmingly and terminate the program. You may copy my function definition, or use your own: // The following 4 lines should be present if we have a die function: #include <iostream> // cout, endl #include <string> // string #include <cstdlib> // exit, EXIT_FAILURE using namespace std; bool die(const string & msg){ cout <<"Fatal error: " <<msg <<endl; exit(EXIT_FAILURE); } 4. Use rand to randomly choose one of the five operators * /...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT