Question: Write a definition for a class named Book with attributes title , price and author , where author is a Contact object and title is
Write a definition for a class named Book with attributes title, price and author, where author is a Contact object and title is a String, and price is a float number.
You also need to define the Contact class, which has attributes name and email, where name and email are both String.
Instantiate a couple of Book objects that represents books with title, price and author (You can come up with the attributes values for each object)
Write a function named print_book that takes an object of Book and prints out the value of its attributes. (Make the message friendly to read, for example "Book title: [sometitle]", "Book price: [$33.75]", etc
Write a function named which_is_more_expensive that takes two Book objects as parameters and returns the reference of the Book object with higher price
Write a function named which_is_more_expensive_by_copy that takes two Book objects as parameters and returns a copy of the Book object with higher price
Write a function named calculate_total_price that takes two Book objects as parameters and returns the total price of the two books
Make functions calls of all these functions by passing the Book objects you created.
[Check point] Submit your python code as .py file in text format, and capture the screens of your program running showing the input and output.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
