1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
allochka39001 [22]
3 years ago
9

Define the Artist class with a constructor to initialize an artist's information and a print_info() method. The constructor shou

ld 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
class Artist:
# TODO: Define constructor with parameters to initialize instance attributes
# (name, birth_year, death_year)

# TODO: Define print_info() method. If death_year is -1, only print birth_year


class Artwork:
# TODO: Define constructor with parameters to initialize instance attributes
# (title, year_created, artist)

# TODO: Define print_info() method


if __name__ == "__main__":
user_artist_name = input()
user_birth_year = int(input())
user_death_year = int(input())
user_title = input()
user_year_created = int(input())

user_artist = Artist(user_artist_name, user_birth_year, user_death_year)

new_artwork = Artwork(user_title, user_year_created, user_artist)

new_artwork.print_info()
Computers and Technology
1 answer:
nika2105 [10]3 years ago
8 0

Answer:

class Artist():

   def __init__(self, artist_name=None, artist_birth_year=0, artist_death_year=0):

       self.artist_name = artist_name

       self.artist_birth_year = artist_birth_year

       self.artist_death_year = artist_death_year

   def display_artist(self):

       if self.artist_death_year == -1:

           print('{}, born {}'.format(self.artist_name, self.artist_birth_year))

       else:

           print('{} ({}-{})'.format(self.artist_name, self.artist_birth_year, self.artist_death_year))

class Artwork():

   def __init__(self, artwork_title=None, artwork_year_created=0, artist=Artist()):

       self.artwork_title = artwork_title

       self.artwork_year_created = artwork_year_created

       self.artist = artist

   def display_artist(self):

       print('artwork_title: {}'.format(self.artwork_title))

       print('Artist: ', end='')

       self.artist.display_artist()

def main():

   user_artist_name = input('Enter the name of artist: ')

   user_birth_year = int(input('Enter birth year: '))

   user_death_year = int(input('Enter death year: '))

   user_title = input('Enter master piece title: ')

   user_year_created = int(input('Enter year created: '))

   user_artist = Artist(user_artist_name, user_birth_year, user_death_year)

   new_artwork = Artwork(user_title, user_year_created, user_artist)

   new_artwork.display_artist()

if __name__ == "__main__":

   main()

Explanation:  

  • Inside the constructor of Artist class, initialize the essential properties.
  • Create the display_artist function that checks whether artist_death_year is equal to -1 and then displays an appropriate message according to the condition.
  • Apply the similar steps as above for the Artwork class.
  • Inside the main method, get the information from user and finally call the display_artist function to print the results on screen.
You might be interested in
Please solve this in JAVA<br><br> Please see the attachment
Alina [70]

Answer:

I'm going to do it but you should try these things for yourself or else you won't learn.

Explanation:

-First create a project (I'm using Netbeans 14 and the project is a Maven, but the code should work on any IDE)


-Name the project 'ShoppingCartPrinter' and leave the package name as it is. This is the main class so the main method is gonna be there already.

-Then you will create a second class named 'ItemToPurchase'. So I'll leave the code in the attachment (at the bottom of my answer it's written 'Download txt') or else brainly will think it's some sort of redirection to another websites because of the 'dots' and won't let me post it.






Download txt
3 0
1 year ago
Which of the following is a default letter assigned for the primary hard drive
d1i1m1o1n [39]

C

.............

When hard disk drives became standard in most PCs in the later 1980s, since the first two letters were already commonly used for these floppy drives, they logically labeled the third storage device “C”, even though it now tended to be the main storage medium for the computer, including usually containing the operating system.

6 0
3 years ago
Read 2 more answers
Write a function that accepts an argument for a persons name. The method should loop through the number of characters in the nam
MatroZZZ [7]

Answer:

#include <iostream>

#include<string.h>

using namespace std;

void printCharacter(string name){

   for(int i=0;name[i]!='\0';i++){

       cout<<name[i]<<endl;

   }

}

int main()

{

   string name;

   cout<<"enter the name: ";

   cin>>name;

   printCharacter(name);

}

Explanation:

first include the two libraries iostream for input/output and string library for using the string.

then, create the main function and declare the variable type string.

cout instruction is used o display the message on the screen.

cin is used to store the value in the name variable.

after that, call the function. The program control move to the the function. In the function for loop is used to print the character one by one until end of the name.

4 0
3 years ago
QUESTION 56 Use the Windows ________ to check on a nonresponsive program. Backup utility Error-checking System Restore Task Mana
ASHA 777 [7]

Answer: Task manager

Explanation: The task manager window represents an interface in personal computers manufactures by Microsoft. The task manager window contains several information about a computers current processes usually displayed in graphical manner, in addition it provides information on the current running processes and application, the uptime of the computer, the graphic processor. With the task manager window users can set process priorities and prioritize applications, by affording users to view process and their corresponding load on the CPU, users can terminate or close applications from within the task manager interface. Hence non-responsuve programs can be viewed and terminated.

5 0
3 years ago
Fill in the blank: the final step of the dhcp discovery process is known as ______. Multiple choice, shuffle.
Ugo [173]

The configuration procedure moves into its final stage once the DHCP server has received the DHCPREQUEST message from the client. An acknowledgement packet, or DHCPACK, is sent to the client at this step.

<h3>What final step of the DHCP discovery process?</h3>

After selecting the proper IP address, the server sends the client an OFFER packet, and the client replies with a REQUEST packet. The process ends with the server sending an ACK packet to confirm that the client has received an IP address.

Therefore, DHCP may dynamically issue IP addresses to any Internet-connected device, node, or client computer.

Learn more about DHCP here:

brainly.com/question/28150867

#SPJ1

6 0
1 year ago
Other questions:
  • How to get 60 fps pubg​
    9·2 answers
  • Which method allows a computer to react accordingly when it requests data from a server and the server takes too long to respond
    5·1 answer
  • Which of the following statements is NOT true about a mainframe computer?
    14·1 answer
  • True / False<br> The exponent in floating point is stored as a biased value.
    9·1 answer
  • 9.1.3: Printing vector elements with a for loop. Write a for loop to print all NUM_VALS elements of vector courseGrades, followi
    5·1 answer
  • The _______ within a story are the people and/or objects that the story is about
    5·2 answers
  • If we need to manage a contiguous range of memory, handling requests to allocate various sized chunks, and later make those chun
    12·1 answer
  • A folder is a collection of related of data is true or false​
    10·2 answers
  • Years ago when working a helpdesk, the most common question asked, almost daily, was about resetting passwords. What type of kno
    11·1 answer
  • What is the purpose of heading tags?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!