Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

15.16.2. Create More Book Objects Change the following main function to create a third book object called b3 with a title of 1984 and author

15.16.2. Create More Book Objects Change the following main function to create a third book object called b3 with a title of 1984 and author George Orwell. Print out the values using the print function in the main.

class Book: """ Represents a book object """

def __init__(self, title, author):

self.title = title self.author = author def __str__(self):

return "title: " + self.title + " author: " + self.author def get_title(self):

return self.title def get_author(self): return self.get_author def set_author(self, author):

self.author = author def set_title(self, title): self.title = title def main():

b2 = Book("A Wrinkle in Time", "M. L'Engle") print(b2) b2.set_author("Madeleine L'Engle") print(b2) b1 = Book("Goodnight Moon", "Margaret Wise Brown") print(b1) main()

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

Step: 3

blur-text-image

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

Beginning VB 2008 Databases

Authors: Vidya Vrat Agarwal, James Huddleston

1st Edition

1590599470, 978-1590599471

More Books

Students also viewed these Databases questions

Question

1.who the father of Ayurveda? 2. Who the father of taxonomy?

Answered: 1 week ago

Question

Commen Name with scientific name Tiger - Wolf- Lion- Cat- Dog-

Answered: 1 week ago