Question: in python Define a class called Author that has attributes Author name,Emailid,Contact_number Write get and set methods for each attribute as shown in UML below.
in python Define a class called Author that has attributes Author name,Emailid,Contact_number Write get and set methods for each attribute as shown in UML below. __init__ method in Author class, should only take name and self parameters. Emailid should be name concatenated with @yahoo.com . Contact number should be randomly generated 7 digit number Write a class called Book that has attributes named title, author,number_pages and price. Book is a subclass of Author class. Write get and set methods for each attribute. Write a driver program that tests the Book class. Allow the user to enter as many book objects as s/he wants. Create an list of book objects. Display email id and contact numbers of all the authors. Sample input to program:
Enter title : Python Programming
Enter Author name: Tony
Enter Number of Pages in book: 722
Enter Price of book 150
Enter title : C++ Programming
Enter Author name: Gaddis
Enter Number of Pages in book: 530
Enter Price of book 100
Enter title : Server side Programming
Enter Author name: Russel
Enter Number of Pages in book: 900
Enter Price of book 120
Enter title : Java Programming
Enter Author name: Loftus
Enter Number of Pages in book:400
Enter Price of book 75 Expected Output :
Tony can be contacted through either Tony@yahoo.com or 5234567
Gaddis can be contacted through either Gaddis@yahoo.com or 6127832
Russel can be contacted through either Russel@yahoo.com or 5426534
Loftus can be contacted through either Loftus@yahoo.com or 2123453
| Book(Author) |
| Title Author Name Price Number_of_Pages |
| getName() getAuthor() getPrice() getnum_Pages() setName() setAuthors() setPrice() setnum_Pages() |
| Author |
| Name Gender Email id |
| setName() setEmailID() setGender(). getName() getEmailID() getGender() |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
